MongoDB::WriteConcern(3pm)

MongoDB::WriteConcern3pm

Encapsulate and validate a write concern

Usage

    $rp = MongoDB::WriteConcern->new(); # w:1, wtimeout: 1000
    $rp = MongoDB::WriteConcern->new(
        w        => 'majority',
        wtimeout => 10000, # milliseconds
    );

Version

version v2.2.2

Overview

A write concern describes the guarantee that MongoDB provides when reporting on the success of a write operation.

For core documentation on read preference see <http://docs.mongodb.org/manual/core/read-preference/>.

Attributes

w

Specifies the desired acknowledgement level. If not set, the server default will be used, which is usually "1".

wtimeout

Specifies how long to wait for the write concern to be satisfied (in milliseconds). Defaults to 1000. If you set this to undef, it could block indefinitely (or until socket timeout is reached).

j

The j option confirms that the mongod instance has written the data to the on-disk journal. Defaults to false.

Note: specifying a write concern that set j to a true value may result in an error with a mongod or mongos running with --nojournal option now errors.

Releases

5 releases since Debian 9 (Stretch); the text changed 4 times.

  1. 9
  2. 10
  3. 11
  4. 12
  5. 13