Class WriteConcern

A MongoDB WriteConcern, which describes the level of acknowledgement requested from MongoDB for write operations.

Constructors

  • Constructs a WriteConcern from the write concern properties.

    Parameters

    • Optionalw: W

      request acknowledgment that the write operation has propagated to a specified number of mongod instances or to mongod instances with specified tags.

    • OptionalwtimeoutMS: number

      specify a time limit to prevent write operations from blocking indefinitely

    • Optionaljournal: boolean

      request acknowledgment that the write operation has been written to the on-disk journal

    • Optionalfsync: boolean | 1

      equivalent to the j option. Is deprecated and will be removed in the next major version.

    Returns WriteConcern

Properties

fsync?: boolean | 1

Equivalent to the j option.

Will be removed in the next major version. Please use journal.

j?: boolean

Request acknowledgment that the write operation has been written to the on-disk journal.

Will be removed in the next major version. Please use journal.

journal?: boolean

Request acknowledgment that the write operation has been written to the on-disk journal

w?: W

Request acknowledgment that the write operation has propagated to a specified number of mongod instances or to mongod instances with specified tags. If w is 0 and is set on a write operation, the server will not send a response.

wtimeout?: number

Specify a time limit to prevent write operations from blocking indefinitely.

Will be removed in the next major version. Please use wtimeoutMS.

wtimeoutMS?: number

Specify a time limit to prevent write operations from blocking indefinitely.

Methods