leafnode.Collection

This constructor should not be called directly. Use DB.getCollection()

Instance Properties

_collection
mongodb.Collection
Required
Description xxx
db
DB
Required
Description xxx

Methods

count  
Arguments
  • query (Object) – xxx
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Returns The number of documents in this collection
Return type number
Description count description
createIndex  
Arguments
  • fieldOrSpec (string | object) – Defines the index.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • options.unique (boolean) – Creates an unique index.
  • options.sparse (boolean) – Creates a sparse index.
  • options.background (boolean) – Creates the index in the background, yielding whenever possible.
  • options.dropDups (boolean) – A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value
  • options.min (number) – For geospatial indexes set the lower bound for the co-ordinates.
  • options.max (number) – For geospatial indexes set the high bound for the co-ordinates.
  • options.v (number) – Specify the format version of the indexes.
  • options.expireAfterSeconds (number) – Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher)
  • options.name (number) – Override the autogenerated index name (useful if the resulting name is larger than 128 bytes)
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns returns index name
Return type string
Description Creates an index on the db and collection collection.
deleteMany  
Arguments
  • selector (object) – The Filter used to select the documents to delete
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~deleteWriteOpResult
Return type object
Description Delete multiple documents.
deleteObject  
Arguments
  • _id (xxx) – The _id of the doc to delete.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error | LeafnodeObjectSetOperationError
Description Delete a single document.
deleteObjects  
Arguments
  • _ids (xxx) – The _ids of the docs to delete.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error | LeafnodeObjectSetOperationError
Description Delete multiple documents.
deleteOne  
Arguments
  • selector (object) – The selector used to select the document to delete
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~deleteWriteOpResult
Return type object
Description Delete a single document.
distinct  
Arguments
  • key (string) – Field of the document to find distinct values for.
  • query (object) – The query for filtering the set of documents to which we apply the distinct filter.
  • options (object) – Optional settings.
  • options.readPreference (ReadPreference | string) – The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns returns array of distinct values
Return type xxx
Description The distinct command returns returns a list of distinct values for the given key across a collection.
drop  
Arguments
  • options (object) – Optional settings (not currently used)
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns returns true if collection dropped, false otherwise
Return type boolean
Description Drop the collection from the database, removing it permanently. New accesses will create a new collection.
dropAllIndexesa  
Deprecated
Arguments
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns returns true if removed, false otherwise
Return type boolean
Description Drops all indexes from this collection.
dropIndex  
Arguments
  • indexName (string) – Name of the index to drop.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns returns object containing ok:0|1 and nIndexesWas:total indexes
Return type Object
Description Drops an index from this collection.
dropIndexes  
Arguments
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns returns true if removed, false otherwise
Return type boolean
Description Drops all indexes from this collection.
ensureIndex  
Deprecated
Arguments
  • fieldOrSpec (string | object) – Defines the index.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • options.unique (boolean) – Creates an unique index.
  • options.sparse (boolean) – Creates a sparse index.
  • options.background (boolean) – Creates the index in the background, yielding whenever possible.
  • options.dropDups (boolean) – A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value
  • options.min (number) – For geospatial indexes set the lower bound for the co-ordinates.
  • options.max (number) – For geospatial indexes set the high bound for the co-ordinates.
  • options.v (number) – Specify the format version of the indexes.
  • options.expireAfterSeconds (number) – Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher)
  • options.name (number) – Override the autogenerated index name (useful if the resulting name is larger than 128 bytes)
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns returns index name
Return type string
Description Ensures that an index exists, if it does not it creates it
find  
Arguments
  • query (object) – The cursor query object.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns xxx
Return type Cursor
Description Creates a cursor for a query that can be used to iterate over results from MongoDB. Note that query options are exposed through the Cursor api.
findAndModify  
Deprecated
Arguments
  • query (object) – Query object to locate the object to modify.
  • sort (array) – If multiple docs match, choose the first one in the specified sort order as the object to manipulate.
  • doc (object) – The fields/vals to be updated.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • options.remove (boolean) – Set to true to remove the object before returning.
  • options.upsert (boolean) – Perform an upsert operation.
  • options.new (boolean) – Set to true if you want to return the modified object rather than the original. Ignored for remove.
  • options.fields (object) – Object containing the field projection for the result returned from the operation.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~findAndModifyWriteOpResult
Return type object
Description Find and update a document.
findOne  
Arguments
  • query (object) – Query for find Operation
  • options (object) – Optional settings.
  • options.limit (number) – Sets the limit of documents returned in the query.
  • options.sort (array | object) – Set to sort the documents coming back from the query. Array of indexes, [[‘a’, 1]] etc.
  • options.fields (object) – The fields to return in the query. Object of fields to include or exclude (not both), {‘a’:1}
  • options.skip (number) – Set to skip N documents ahead in your query (useful for pagination).
  • options.hint (Object) – Tell the query to use specific indexes in the query. Object of indexes to use, {‘_id’:1}
  • options.explain (boolean) – Explain the query instead of returning the data.
  • options.snapshot (boolean) – Snapshot query.
  • options.timeout (boolean) – Specify if the cursor can timeout.
  • options.tailable (boolean) – Specify if the cursor is tailable.
  • options.batchSize (number) – Set the batchSize for the getMoreCommand when iterating over the query results.
  • options.returnKey (boolean) – Only return the index key.
  • options.maxScan (number) – Limit the number of items to scan.
  • options.min (number) – Set index bounds.
  • options.max (number) – Set index bounds.
  • options.showDiskLoc (boolean) – Show disk location of results.
  • options.comment (string) – You can put a $comment field on a query to make looking in the profiler logs simpler.
  • options.raw (boolean) – Return all BSON documents as Raw Buffer documents.
  • options.readPreference (ReadPreference | string) – The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
  • options.partial (boolean) – Specify if the cursor should return partial results when querying against a sharded system
  • options.maxTimeMS (number) – Number of miliseconds to wait before aborting the query.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns returns the doc if found or null if not found
Return type object
Description Fetches the first document that matches the query
findOneAndDelete  
Arguments
  • query (object) – Document selection query.
  • options (object) – Optional settings.
  • options.projection (object) – Limits the fields to return for all matching documents.
  • options.sort (object) – Determines which document the operation modifies if the query selects multiple documents.
  • options.maxTimeMS (number) – The maximum amount of time to allow the query to run.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~findAndModifyWriteOpResult
Return type object
Description Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation.
findOneAndReplace  
Arguments
  • query (object) – Document selection query.
  • replacement (object) – Document replacing the matching document.
  • options (object) – Optional settings.
  • options.projection (object) – Limits the fields to return for all matching documents.
  • options.sort (object) – Determines which document the operation modifies if the query selects multiple documents.
  • options.maxTimeMS (number) – The maximum amount of time to allow the query to run.
  • options.upsert (boolean) – Upsert the document if it does not exist.
  • options.returnOriginal (boolean) – When false, returns the updated document rather than the original. The default is true.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~findAndModifyWriteOpResult
Return type object
Description Find a document and replace it in one atomic operation, requires a write lock for the duration of the operation.
findOneAndUpdatea  
Arguments
  • query (object) – Document selection query.
  • update (object) – Update operations to be performed on the document
  • options (object) – Optional settings.
  • options.projection (object) – Limits the fields to return for all matching documents.
  • options.sort (object) – Determines which document the operation modifies if the query selects multiple documents.
  • options.maxTimeMS (number) – The maximum amount of time to allow the query to run.
  • options.upsert (boolean) – Upsert the document if it does not exist.
  • options.returnOriginal (boolean) – When false, returns the updated document rather than the original. The default is true.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~findAndModifyWriteOpResult
Return type object
Description Find a document and update it in one atomic operation, requires a write lock for the duration of the operation.
getIndexes  
Arguments
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns returns array of indexes each with name, namespace and key
Return type array
Description Retrieve all the indexes on the collection.
group  
Arguments
  • keys (object | array | function | code) – An object, array or function expressing the keys to group by.
  • condition (object) – An optional condition that must be true for a row to be considered.
  • initial (object) – Initial value of the aggregation counter object.
  • reduce (function | Code) – The reduce function aggregates (reduces) the objects iterated
  • finalize (function | Code) – An optional function to be run on each item in the result set just before the item is returned.
  • command (boolean) – Specify if you wish to run using the internal group command or using eval, default is true.
  • options (object) – Optional settings.
  • options.readPreference (ReadPreference | string) – The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns returns results of the group command
Return type array
Description Run a group command across a collection
indexInformationa  
Arguments
  • options (object) – Optional settings.
  • options.full (boolean) – Returns the full raw index information.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns The result object.
Return type object
Description Retrieves this collection’s index information.
insert  
Deprecated
Arguments
  • docs (object | object) – Documents to insert.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • options.serializeFunctions (boolean) – Serialize functions on any object.
  • options.forceServerObjectId (boolean) – Force server to assign _id values instead of driver.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertWriteOpResult
Return type object
Description Inserts a single document or an array of documents into MongoDB.
insertMany  
Arguments
  • docs (object) – Documents to insert.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • options.serializeFunctions (boolean) – Serialize functions on any object.
  • options.forceServerObjectId (boolean) – Force server to assign _id values instead of driver.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error xxx
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertWriteOpResult
Return type object
Description Inserts an array of documents into MongoDB.
insertObject  
Arguments
  • doc (object) – Document to insert.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • options.serializeFunctions (boolean) – Serialize functions on any object.
  • options.forceServerObjectId (boolean) – Force server to assign _id values instead of driver.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns The inserted document.
Return type object
Description Inserts a single document into MongoDB.
insertObjects  
Arguments
  • docs (object) – Documents to insert.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • options.serializeFunctions (boolean) – Serialize functions on any object.
  • options.forceServerObjectId (boolean) – Force server to assign _id values instead of driver.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns The inserted documents.
Return type object
Description Inserts an array of documents into MongoDB.
insertOne  
Arguments
  • doc (object) – Document to insert.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • options.serializeFunctions (boolean) – Serialize functions on any object.
  • options.forceServerObjectId (boolean) – Force server to assign _id values instead of driver.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertOneWriteOpResult
Return type object
Description Inserts a single document into MongoDB.
isCappeda  
Arguments
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns returns true if capped, false otherwise
Return type boolean
Description Returns if the collection is a capped collection
mapReduce  
Arguments
  • map (function | string) – The mapping function.
  • reduce (function | string) – The reduce function.
  • options (object) – Optional settings.
  • options.readPreference (ReadPreference | string) – The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
  • options.out (object) – Sets the output target for the map reduce job. {inline:1} | {replace:’collectionName’} | {merge:’collectionName’} | {reduce:’collectionName’}
  • options.query (object) – Query filter object.
  • options.sort (object) – Sorts the input objects using this key. Useful for optimization, like sorting by the emit key for fewer reduces.
  • options.limit (number) – Number of objects to return from collection.
  • options.keeptemp (boolean) – Keep temporary data.
  • options.finalize (function | string) – Finalize function.
  • options.scope (object) – Can pass in variables that can be access from map/reduce/finalize.
  • options.jsMode (boolean) – It is possible to make the execution stay in JS. Provided in MongoDB > 2.0.X.
  • options.verbose (boolean) – Provide statistics on job execution time.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns returns the temporary collection with results of the mapReduce
Return type Collection
Description Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.
reIndex  
Arguments
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns returns true if reindex succeeded, false otherwise
Return type boolean
Description Reindex all indexes on the collection Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.
remove  
Deprecated
Arguments
  • selector (object) – The selector for the update operation.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • options.single (boolean) – Removes the first document found.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~WriteOpResult
Return type object
Description Remove one or many documents.
removeMany  
Deprecated
Arguments
  • selector (object) – The Filter used to select the documents to remove
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~deleteWriteOpResult
Return type object
Description Remove multiple documents.
removeObject  
Deprecated
Arguments
  • _id (xxx) – The _id of the doc to remove.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error | LeafnodeObjectSetOperationError
Description Remove a single document.
removeObjects  
Deprecated
Arguments
  • _ids (xxx) – The _ids of the docs to remove.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error | LeafnodeObjectSetOperationError
Description Remove multiple documents.
removeOne  
Deprecated
Arguments
  • selector (object) – The selector used to select the document to remove
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~deleteWriteOpResult
Return type object
Description Remove a single document.
rename  
Arguments
  • newName (string) – New name of of the collection.
  • options (object) – Optional settings.
  • options.dropTarget (boolean) – Drop the target name collection if it previously exists.
  • callback (Collection~collectionResultCallback) – The results callback
Returns returns Promise if no callback passed
Return type Promise
Description Rename the collection.
save  
Arguments
  • doc (object) – Document to save
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~WriteOpResult
Return type object
Description Save a document. Simple full document replacement function. Not recommended for efficiency, use atomic operators and update instead for more efficient operations.
saveObject  
Arguments
  • doc (object) – Document to save.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error If exactly 1 document is not saved.
Returns Returns true iff save resulted in an upsert.
Return type boolean
Description Save a document. Simple full document replacement function. Not recommended for efficiency, use atomic operators and update instead for more efficient operations. XXX: this only seems to report “upsert”s appropriately when you set the _id explicitly…
stats  
Arguments
  • options (object) – Optional settings.
  • options.scale (number) – Divide the returned sizes by scale value.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns returns collection statistics
Return type object
Description Get all the collection statistics.
update  
Deprecated
Arguments
  • query (object) – The selector for the update operation.
  • doc (object) – The update document.
  • options (object) – Optional settings.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • options.upsert (boolean) – Update operation is an upsert.
  • options.multi (boolean) – Update one/all documents with operation.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~updateWriteOpResult
Return type object
Description Updates documents.
updateMany  
Arguments
  • query (object) – The query used to select the document to update
  • update (object) – The update operations to be applied to the document
  • options (object) – Optional settings.
  • options.upsert (boolean) – Update operation is an upsert.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~updateWriteOpResult
Return type object
Description Update multiple documents.
updateObject  
Arguments
  • _id (xxx) – The _id of the doc to update.
  • update (object) – The update operations to be applied to the document.
  • options (object) – Optional settings.
  • options.upsert (boolean) – Update operation is an upsert.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error | LeafnodeObjectSetOperationError
Description Update a single document.
updateObjects  
Arguments
  • _ids (xxx) – The _ids of the docs to update.
  • update (object) – The update operations to be applied to the document.
  • options (object) – Optional settings.
  • options.upsert (boolean) – Update operation is an upsert.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error | LeafnodeObjectSetOperationError
Description Update multiple documents.
updateOne  
Arguments
  • query (object) – The query used to select the document to update
  • update (object) – The update operations to be applied to the document
  • options (object) – Optional settings.
  • options.upsert (boolean) – Update operation is an upsert.
  • options.w (number | string) – The write concern.
  • options.wtimeout (number) – The write concern timeout.
  • options.j (boolean) – Specify a journal write concern.
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~updateWriteOpResult
Return type object
Description Update a single document.