Setting Query Database Operation
Each Query object must have a database operation associated with it. The database operation determines what action to take when connecting to the database—from finding documents to storing them. There are two ways to assign a database operation to a Query object. One is to call the operation from the Model object and not specify a callback. The Query object returned has that operation assigned to it. For example:
var query = model.find();
Once you already have a Query object, you can change the operation that is applied by calling the method on the Query object. For example, the following code creates a Query object that first applies a count() operation and then a find() operation. The where() clause is applied ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access