• Public
  • Public/Protected
  • All

Interface UpdateOptions


  • UpdateOptions




Optional j

j: undefined | true | false

Whether to wait for the write to be commited to the server's journal (flushed to disk) or not. By specifying 1 here, you imply w:1 - howver this can be combined with w:"majority" to give excellent write reliability within a cluster, even across failures.

Optional multi

multi: undefined | true | false

Whether to update multiple documents at once, defaults to false unless run using a method which explcitly sets it to true.

Optional upsert

upsert: undefined | true | false

Whether to perform an upsert operation if the document already exists. This can be combined with $setOnInsert to automatically create documents which do not exist in the database prior to making changes - and can be very handy for high-throughput systems.

Optional w

w: string | number

The write concern, can either be a number from 0 to the number of nodes within the cluster, or "majority" if you would like to wait for the majority of nodes within the cluster to confirm the write before returning.

It is recommended that you set this to "majority", however in all situations where you mind if data is lost, you should set it to at least 1.

Optional wtimeout

wtimeout: undefined | number

The timeout in milliseconds before the write will be aborted by the MongoDB server and an error response (if the write concern is non-zero) is returned to the client.

Generated using TypeDoc