Class Node<T>

A Query Node saves the state of the query being built

Type Parameters

Hierarchy

Constructors

Properties

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

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 Node<T>

  • Parameters

    • offset: number

    Returns Node<T>

  • Parameters

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

    Returns Node<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>

  • Parameters

    Returns JsonMap

  • 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

  • Returns string

  • Returns string

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

Generated using TypeDoc