Mongo-Style Modifiers
A modifier is an object that describes how to update a document in place by changing some of its fields. Some examples:
1 2 3 4 5 6 | // Set the 'admin' property on the document to true {$set: {admin: true }} // Add 2 to the 'votes' property, and add "Traz" // to the end of the 'supporters' array {$inc: {votes: 2}, $push: {supporters: "Traz" }} |
But if a modifier doesn't contain any $-operators, then it is instead interpreted as a literal document, and completely replaces whatever was previously in the database. (Literal document modifiers are not currently supported by validated updates.)
1 2 | // Find the document with id "123", and completely replace it. Users.update({_id: "123" }, {name: "Alice" , friends: [ "Bob" ]}); |
See the full list of modifiers.
Please login to continue.