June 2014
Intermediate to advanced
696 pages
38h 52m
English
The Collection object provides the findAndModify() function, which performs an atomic write on a single document in a collection. This is extremely useful if you need to ensure that no other processes can write to your document at the same time. The following is the syntax for the findAndModify() method:
findAndModify(query, sort, update, [options], callback)
The query parameter is a document that is used to identify which document you want to modify. The request matches the properties and values in the query parameter with the fields and values of the object, and only those that match the query are modified.
The sort parameter is an array of [field, sort_order] pairs ...
Read now
Unlock full access