Represents a query object used to filter and match documents based on specified criteria.
The Query class provides methods to compile query conditions, test objects against the query criteria, and retrieve matching documents from a collection.
Query
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
The type of objects being queried.
Creates an instance of the query with the specified condition and options.
The query condition object used to define the criteria for matching documents.
Optional
Optional configuration settings to customize the query behavior.
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.
The
Query
class provides methods to compile query conditions, test objects against the query criteria, and retrieve matching documents from a collection.Example
Template: T
The type of objects being queried.