Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface CreateOptions

Options which can be used to control the way in which a document is created on the MongoDB server.

Hierarchy

  • CreateOptions

Index

Properties

Optional cache

cache: undefined | true | false

Whether to store the resulting document in the Iridium document cache to boost later retrieval times.

Optional forceServerObjectId

forceServerObjectId: undefined | true | false

Whether to generate document ObjectIDs within the client library or on the server, it is recommended that you leave this to default (false) unless you are making thousands of inserts per second from a single node and experiencing _id collisions.

Optional j

j: undefined | number

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 serializeFunctions

serializeFunctions: undefined | true | false

Whether or not to serialize JavaScript functions which are provided as values. For security reasons it is probably best to set this to false, however it may come in handy under certain circumstances.

Optional upsert

upsert: undefined | true | false

Whether to perform an upsert operation if the document already exists.

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