Represents a query object used to filter and match documents based on specified criteria. All query, projection, and related expression operators are preloaded into the context by default.
const query = new Query({ age: { $gt: 18 } });const result = query.test({ name: "John", age: 25 }); // true Copy
const query = new Query({ age: { $gt: 18 } });const result = query.test({ name: "John", age: 25 }); // true
Optional
Returns a cursor for iterating over the items in the given collection that match the query criteria.
The type of the items in the resulting cursor.
The source collection to search through.
An optional object specifying fields to include or exclude in the returned items.
A Cursor instance for iterating over the matching items.
Cursor
Tests whether the given object satisfies all compiled predicates.
The type of the object to test.
The object to be tested against the compiled predicates.
true if the object satisfies all predicates, otherwise false.
true
false
Represents a query object used to filter and match documents based on specified criteria. All query, projection, and related expression operators are preloaded into the context by default.
Example