price: 2.5, ratings: [ 5, 8, 9 ], memos: [ { memo: "on time", by: "shipping" }, { memo: "approved", by: "billing" } ] } 

Combination of Elements Satisfies the Criteria The following example queries for documents where the memos array contains elements that in some combination satisfy the query conditions; e.g. one element satisfies the field memo equal to ’on time’ condition and another element satisfies the field by equal to ’shipping’ condition, or a single element can satisfy both criteria: 

db.inventory.find( { 'memos.memo': 'on time', 'memos.by': 'shipping' } ) 

The query returns the following documents: 

{ _id: 100, type: "food", item: "xyz", qty: 25, price: 2.5, ratings: [ 5, 8, 9 ], memos: [ { memo: "on time", by: "shipping" }, { memo: "approved", by: "billing" } ] } { _id: 101, type: "fruit", item: "jkl", qty: 10, price: 4.25, ratings: [ 5, 9 ], memos: [ { memo: "on time", by: "payment" }, { memo: "delayed", by: "shipping" } ] } 

## See also: 

Limit Fields to Return from a Query (page 107) 

## 3.3.3 Modify Documents 

MongoDB provides the update() method to update the documents of a collection. The method accepts as its parameters: 

• an update conditions document to match the documents to update, 

• an update operations document to specify the modification to perform, and 

• an options document. 

To specify the update condition, use the same structure and syntax as the query conditions. 

By default, update() updates a single document. To update multiple documents, use the multi option. 

