Class Operator<T>

An Operator saves the state of a combined query

Type Parameters

Hierarchy

Constructors

  • Type Parameters

    Parameters

    • entityManager: EntityManager

      The owning entity manager of this query

    • resultClass: Class<T>

      The query result class

    • operator: string

      The operator used to join the childes

    • childes: Node<T>[]

      The childes to join

    Returns Operator<T>

Properties

childes: Node<T>[]

The child Node of this query, it is always one

entityManager: EntityManager

The owning EntityManager of this query

firstResult: number = 0

The offset how many results should be skipped

maxResults: number = -1

The limit how many objects should be returned

operator: string

The operator used to join the child queries

order: {
    [field: string]: 1 | -1;
} = {}

The properties which should be used sort the result

Type declaration

  • [field: string]: 1 | -1
resultClass: Class<T>

The result class of this query

MAX_URI_SIZE: 2000 = 2000

Methods

  • Parameters

    • limit: number

    Returns Operator<T>

  • Parameters

    • offset: number

    Returns Operator<T>

  • Parameters

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

    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>

  • 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>

  • 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

  • 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

  • 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>

  • Returns {
        [operator: string]: Node<T>[];
    }

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

Generated using TypeDoc