Understanding Query options Objects

In addition to the query object, most of the methods of retrieving documents using the MongoDB Node.js driver also include an options object. The options object allows you to define the behavior of the request when retrieving documents. It allows you to limit the result set, sort items while creating the result set, and much more.

Table 15.2 lists the options that can be set on methods that retrieve documents from the MongoDB server. Not all of these methods are available on every request. For example, when counting items that match a query, it doesn’t make sense to specify a limit on the result.

Image
Image

Table 15.2 Options that can be specified in the options object when querying documents

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.189.129