Class Builder<T>

An abstract Query which allows retrieving results

Type Parameters

Hierarchy

Constructors

Properties

entityManager: EntityManager

The owning EntityManager of this query

resultClass: Class<T>

The result class of this query

MAX_URI_SIZE: 2000 = 2000

Methods

  • Parameters

    • field: null | string
    • filter: null | string
    • value: any

    Returns Filter<T>

  • Parameters

    • limit: number

    Returns Filter<T>

  • Parameters

    • offset: number

    Returns Filter<T>

  • Parameters

    • operator: string
    • args: Node<T>[]

    Returns Operator<T>

  • Parameters

    • fieldOrSort: string | {
          [field: string]: 1 | -1;
      }
    • Optional order: 1 | -1

    Returns Filter<T>

  • Joins the conditions by an logical AND

    Returns

    Returns a new query which joins the given queries by a logical AND

    Parameters

    • Rest ...args: (Query<T> | Query<T>[])[]

      The query nodes to join

    Returns Operator<T>

  • Add an ascending sort for the specified field to this query

    Returns

    The resulting Query

    Parameters

    • field: string

      The field to sort

    Returns Node<T>

  • Adds a between filter to the field. This is a shorthand for an less than and greater than filter.

    Returns

    The resulting Query

    Parameters

    • field: string

      The field to filter

    • greaterValue: string | number | Date | Entity

      The field value must be greater than this value

    • lessValue: string | number | Date | Entity

      The field value must be less than this value

    Returns Filter<T>

  • Adds a contains all filter to the collection field

    The collection must contain all the given values.

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/operator/query/all/

    Parameters

    • field: string

      The field to filter

    • Rest ...args: any[]

      The field value or values to filter

    Returns Filter<T>

  • The collection must contains one of the given values

    Adds a contains any filter to the collection field. Alias for in.

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/operator/query/in/

    Parameters

    • field: string

      The field to filter

    • Rest ...args: any[]

      The field value or values to filter

    Returns Filter<T>

  • Execute the query that returns the matching objects count.

    Returns

    The total number of matched objects

    Parameters

    • Optional doneCallback: CountCallback

      Called when the operation succeed.

    • Optional failCallback: FailCallback

      Called when there is a server-side error

    Returns Promise<any>

  • Add an decending sort for the specified field to this query

    Returns

    The resulting Query

    Parameters

    • field: string

      The field to sort

    Returns Node<T>

  • Adds a equal filter to the field

    All other other filters on the field will be discarded.

    Method

    Parameters

    • field: string

      The field to filter

    • value: any

      The value used to filter

    Returns Filter<T>

  • Adds a equal filter to the field. All other other filters on the field will be discarded

    Returns

    The resulting Query

    Parameters

    • field: string

      The field to filter

    • value: any

      The value used to filter

    Returns Filter<T>

  • Returns an observable that receives change events for a real-time query

    Multiple subscriptions can be created on top of this observable:

    
    var query = DB.Todo.find();
    var options = { ... };
    var stream = query.eventStream(options);
    var sub = stream.subscribe(onNext, onError, onComplete);
    var otherSub = stream.subscribe(otherOnNext, otherOnError, otherOnComplete);
    

    Returns

    an observable

    Parameters

    Returns Observable<RealtimeEvent<T>>

  • Returns a subscription that handles change events for a real-time query.

    The underlying stream object is hidden. To create multiple subscriptions on the same stream, create the stream object first and then subscribe to the stream (see the other signature #eventStream(options)).

    Returns

    a real-time query subscription

    Parameters

    Returns Subscription

  • Adds a greater than or equal to filter to the field

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/operator/query/gte/

    Parameters

    • field: string

      The field to filter

    • value: string | number | Date | Entity

      The value used to filter

    Returns Filter<T>

  • Adds a “in” filter to the field

    The field value must be equal to one of the given values.

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/operator/query/in/

    Parameters

    • field: string

      The field to filter

    • Rest ...args: any[]

      The field value or values to filter

    Returns Filter<T>

  • Adds an “in” filter to the field

    The field value must be equal to one of the given values.

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/operator/query/in/

    Parameters

    • field: string

      The field to filter

    • Rest ...args: any[]

      The field value or values to filter

    Returns Filter<T>

  • Adds a “is not null” filter to the field

    The field value must not be null.

    Returns

    The resulting Query

    Parameters

    • field: string

      The field to filter

    Returns Filter<T>

  • Adds a “is null” filter to the field

    The field value must be null.

    Returns

    The resulting Query

    Parameters

    • field: string

      The field to filter

    Returns Filter<T>

  • Adds a less than or equal to filter to the field

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/operator/query/lte/

    Parameters

    • field: string

      The field to filter

    • value: string | number | Date | Entity

      The value used to filter

    Returns Filter<T>

  • Adds a regular expression filter to the field

    The field value must matches the regular expression.

    Note: Only anchored expressions (Expressions that starts with an ^) and the multiline flag are supported.

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/operator/query/regex/

    Parameters

    • field: string

      The field to filter

    • regExp: string | RegExp

      The regular expression of the filter

    Returns Filter<T>

  • Adds a modulo filter to the field

    The field value divided by divisor must be equal to the remainder.

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/operator/query/mod/

    Parameters

    • field: string

      The field to filter

    • divisor: number

      The divisor of the modulo filter

    • remainder: number

      The remainder of the modulo filter

    Returns Filter<T>

  • Adds a geopoint based near filter to the GeoPoint field

    The GeoPoint must be within the maximum distance to the given GeoPoint. Returns from nearest to farthest.

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/operator/query/nearSphere/

    Parameters

    • field: string

      The field to filter

    • geoPoint: GeoPoint

      The GeoPoint to filter

    • maxDistance: number

      Tha maximum distance to filter in meters

    Returns Filter<T>

  • Joins the conditions by an logical NOR

    Returns

    Returns a new query which joins the given queries by a logical NOR

    Parameters

    • Rest ...args: (Query<T> | Query<T>[])[]

      The query nodes to join

    Returns Operator<T>

  • Adds a “not in” filter to the field

    The field value must not be equal to any of the given values.

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/operator/query/nin/

    Parameters

    • field: string

      The field to filter

    • Rest ...args: any[]

      The field value or values to filter

    Returns Filter<T>

  • Joins the conditions by an logical OR

    Returns

    Returns a new query which joins the given queries by a logical OR

    Parameters

    • Rest ...args: (Query<T> | Query<T>[])[]

      The query nodes to join

    Returns Operator<T>

  • Returns an observable that receives the complete real-time query result

    The full result is received initially (i.e. on subscription) and on every change.

    
    var query = DB.Todo.find();
    var stream = query.resultStream();
    var sub = stream.subscribe(onNext, onError, onComplete);
    var otherSub = stream.subscribe(otherOnNext, otherOnError, otherOnComplete);
    

    Returns

    an observable on which multiple subscriptions can be created on

    Parameters

    Returns Observable<T[]>

  • Returns a subscription that handles the complete real-time query result

    The full result is received initially (i.e. on subscription) and on every change.

    The underlying stream object is hidden. To create multiple subscriptions on the same stream, create the stream object first and then subscribe to the stream (see the other signature #resultStream(options)).

    Returns

    a real-time query subscription handling complete query results.

    Parameters

    Returns Subscription

  • Adds a size filter to the collection field

    The collection must have exactly size members.

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/operator/query/size/

    Parameters

    • field: string

      The field to filter

    • size: number

      The collections size to filter

    Returns Filter<T>

  • Sets the sort of the query and discard all existing paramaters

    Returns

    The resulting Query

    See

    http://docs.mongodb.org/manual/reference/method/cursor.sort/

    Parameters

    • sort: {
          [field: string]: 1 | -1;
      }

      The new sort of the query which is an object whose keys are fields and the values are either +1 for ascending order or -1 for descending order

      • [field: string]: 1 | -1

    Returns Node<T>

  • An object that contains filter rules which will be merged with the current filters of this query

    Returns

    The resulting Query

    Parameters

    • conditions: JsonMap

      Additional filters for this query

    Returns Filter<T>

Generated using TypeDoc