mingo
    Preparing search index...

    Class Query

    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

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    Constructors

    • Creates an instance of the query with the specified condition and options. This object is preloaded with all query and projection operators.

      Parameters

      • condition: AnyObject

        The query condition object used to define the criteria for matching documents.

      • Optionaloptions: Partial<Options>

        Optional configuration settings to customize the query behavior.

      Returns Query

    Methods

    • Returns a cursor for iterating over the items in the given collection that match the query criteria.

      Type Parameters

      • T

        The type of the items in the resulting cursor.

      Parameters

      • collection: Source

        The source collection to search through.

      • Optionalprojection: AnyObject

        An optional object specifying fields to include or exclude in the returned items.

      Returns Cursor<T>

      A Cursor instance for iterating over the matching items.

    • Tests whether the given object satisfies all compiled predicates.

      Type Parameters

      • T

        The type of the object to test.

      Parameters

      • obj: T

        The object to be tested against the compiled predicates.

      Returns boolean

      true if the object satisfies all predicates, otherwise false.