Database Reference
In-Depth Information
db.book.find( { titleName : “Extreme Scoping”, pageCount : 300 } )
You can include any of the following operators as well as other operators described in the
MongoDB reference manual:
Greater than: $gt
Great than or equal to: $gte
Less than: $lt
Less than or equal to: $lte
Not equal to: $ne
Match any or all conditions: $or
Match all conditions: $and
Match all conditions not specified: $not
Match any of the values that exist in an array: $in
Match all documents that contain a specified field: $exists
Increment the value of a field by a certain amount: $inc
For example, if we would like to find all of the topics in this list that are over 275 pages:
Extreme Scoping, 300 pages
Data Engineering, 100 pages
Business unIntelligence, 442 pages
Secrets of Analytical Leaders, 268 pages
We can run this query:
db.book.find( { pageCount : { $gt : 275 } } )
And this would be returned:
Extreme Scoping, 300 pages
Business unIntelligence, 442 pages
We can also add functions to the end of the find statement for further query refinement. If
we wanted to sort the documents returned by titleName , we can run this query:
db.book.find( { pageCount : { $gt : 275 } } ).sort( {titleName : 1 } )
And this would be returned:
Business unIntelligence, 442 pages
Search WWH ::




Custom Search