Understanding Query Objects
Throughout this chapter, the various methods all use a query
object of some sort or another to define which documents to retrieve from a MongoDB collection. The query
object is a standard JavaScript object with special property names that the MongoDB Node.js driver understands. These property names closely match the native queries that you can perform inside the MongoDB client, so you can easily transfer back and forth.
The properties of the query
object are called operators because they operate on the data to determine whether a document should be included in the result set. These operators match the values of fields in a document against specific criteria. For example, to find all documents with a count
value greater ...
Get Node.js, MongoDB, and AngularJS Web Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.