In Chapter 14, “Manipulating MongoDB Documents from Node.js,” you learned about the
find() method of the
Collection object. This method returns a
Cursor object to the callback function, providing access to the documents. If no query is specified, then all documents are returned, which is rarely what you want. Instead, you typically need a subset of documents that match a certain set of criteria.
To limit the number of documents the
find() method finds, you apply a
query object that limits the documents that will be returned in the
The code in Listing 15.1 performs a bunch of different queries against the word collection data set described earlier in this chapter. You should already recognize ...