UNPKG

@harishreddym/baqend

Version:

Baqend JavaScript SDK

2,910 lines (917 loc) 54 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Baqend JavaScript SDK 2.14.1 - Class: Node<T></title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/bootstrap-baqend.min.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> <link type="text/css" rel="stylesheet" href="styles/font-awesome-4.7.0.css"> </head> <body> <nav class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="navbar-inner container"> <!-- Collapsed navigation --> <div class="navbar-header"> <!-- Expander button --> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <!-- Main title --> <a class="navbar-brand" href="/"><img src="img/logo.png"></a> </div> <!-- Expanded navigation --> <div id="nav" class="navbar-collapse collapse"> <!-- Search --> <form class="navbar-right form-inline search-form"> <div class="form-group search-form-group"> <input type="search" class="form-control search-input" id="search-query" placeholder="Search Guide" name="q" autocomplete="off"> <div id="search-results" class="search-results"> <p class="search-no-results">Please enter a search query ...</p> </div> <i class="search-icon fa fa-search"></i> </div> </form> <!-- Main navigation --> <ul class="nav navbar-nav"> <li> <a href="https://dashboard.baqend.com/">Dashboard</a> </li> <!-- Guide Navigation --> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Guide <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="https://www.baqend.com/guide/">Home</a></li> <li><a href="https://www.baqend.com/guide/#speed-kit">Speed Kit</a></li> <li><a href="https://www.baqend.com/guide/#platform">Platform</a></li> <li><a href="https://www.baqend.com/guide/roadmap/">Roadmap</a></li> <li><a href="https://www.baqend.com/guide/topics/faq/">FAQ</a></li> </ul> </li> <!-- Starter Kits --> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Starter Kits <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="https://www.baqend.com/guide/starter-kits/">Starter Kits Overview</a></li> <li><a href="https://www.baqend.com/guide/starter-kits/angular2/">Angular 2 Starter Kit</a></li> <li><a href="https://www.baqend.com/guide/starter-kits/react/">React and Redux Starter Kit</a></li> <li><a href="https://www.baqend.com/guide/starter-kits/bootstrap/">Bootstrap Starter Kit</a></li> <li><a href="https://www.baqend.com/guide/starter-kits/ionic2/">Ionic 2 Starter Kit</a></li> <li><a href="https://www.baqend.com/guide/starter-kits/ionic/">Ionic Starter Kit</a></li> </ul> </li> <li class="active"> <a href="baqend.html">JS API</a> </li> <li> <a href="https://www.baqend.com/tutorial.html">Tutorial</a> </li> </ul> </div> </div> </nav> <div class="box gray pt-32 pb-32"> <div class="container"> <div class="row"> <!-- <div class="col-md-3"></div> --> <div class="bs-sidebar hidden-print fixed affix" role="complementary"> <input class="filter form-control input-sm" type="text" placeholder="FILTER"/> <ul class="nav bs-sidenav"> <li class=""><a href="Acl.html" class="nav-name">Acl</a></li> <li class=""><a href="EntityManager.html" class="nav-name">EntityManager</a></li> <li class=""><a href="EntityManagerFactory.html" class="nav-name">EntityManagerFactory</a></li> <li class=""><a href="GeoPoint.html" class="nav-name">GeoPoint</a></li> <li class=""><a href="RealtimeEvent.html" class="nav-name">RealtimeEvent</a></li> <li class=""><a href="baqend.html" class="nav-name">baqend</a></li> <li class=""> <a href="binding.html" class="nav-name">binding</a> <ul class="nav"> <li class=""><a href="binding.Accessor.html" class="nav-name">Accessor</a></li> <li class=""><a href="binding.DeviceFactory.html" class="nav-name">DeviceFactory</a></li> <li class=""><a href="binding.Enhancer.html" class="nav-name">Enhancer</a></li> <li class=""><a href="binding.Entity.html" class="nav-name">Entity</a></li> <li class=""><a href="binding.EntityFactory.html" class="nav-name">EntityFactory</a></li> <li class=""><a href="binding.Factory.html" class="nav-name">Factory</a></li> <li class=""><a href="binding.File.html" class="nav-name">File</a></li> <li class=""><a href="binding.FileFactory.html" class="nav-name">FileFactory</a></li> <li class=""><a href="binding.Managed.html" class="nav-name">Managed</a></li> <li class=""><a href="binding.ManagedFactory.html" class="nav-name">ManagedFactory</a></li> <li class=""><a href="binding.Role.html" class="nav-name">Role</a></li> <li class=""><a href="binding.User.html" class="nav-name">User</a></li> <li class=""><a href="binding.UserFactory.html" class="nav-name">UserFactory</a></li> </ul> </li> <li class=""> <a href="caching.html" class="nav-name">caching</a> <ul class="nav"> <li class=""><a href="caching.BloomFilter.html" class="nav-name">BloomFilter</a></li> </ul> </li> <li class=""> <a href="connector.html" class="nav-name">connector</a> <ul class="nav"> <li class=""><a href="connector.Connector.html" class="nav-name">Connector</a></li> <li class=""><a href="connector.FetchConnector.html" class="nav-name">FetchConnector</a></li> <li class=""><a href="connector.IFrameConnector.html" class="nav-name">IFrameConnector</a></li> <li class=""><a href="connector.Message.html" class="nav-name">Message</a></li> <li class=""><a href="connector.NodeConnector.html" class="nav-name">NodeConnector</a></li> <li class=""><a href="connector.ObservableStream.html" class="nav-name">ObservableStream</a></li> <li class=""><a href="connector.WebSocketConnector.html" class="nav-name">WebSocketConnector</a></li> <li class=""><a href="connector.XMLHttpConnector.html" class="nav-name">XMLHttpConnector</a></li> <li class=""><a href="connector.ChannelMessage.html" class="nav-name">ChannelMessage</a></li> </ul> </li> <li class=""> <a href="error.html" class="nav-name">error</a> <ul class="nav"> <li class=""><a href="error.CommunicationError.html" class="nav-name">CommunicationError</a></li> <li class=""><a href="error.EntityExistsError.html" class="nav-name">EntityExistsError</a></li> <li class=""><a href="error.IllegalEntityError.html" class="nav-name">IllegalEntityError</a></li> <li class=""><a href="error.PersistentError.html" class="nav-name">PersistentError</a></li> <li class=""><a href="error.RollbackError.html" class="nav-name">RollbackError</a></li> </ul> </li> <li class=""> <a href="metamodel.html" class="nav-name">metamodel</a> <ul class="nav"> <li class=""><a href="metamodel.Attribute.html" class="nav-name">Attribute</a></li> <li class=""><a href="metamodel.BasicType.html" class="nav-name">BasicType</a></li> <li class=""><a href="metamodel.CollectionAttribute.html" class="nav-name">CollectionAttribute</a></li> <li class=""><a href="metamodel.DbIndex.html" class="nav-name">DbIndex</a></li> <li class=""><a href="metamodel.EmbeddableType.html" class="nav-name">EmbeddableType</a></li> <li class=""><a href="metamodel.EntityType.html" class="nav-name">EntityType</a></li> <li class=""><a href="metamodel.ListAttribute.html" class="nav-name">ListAttribute</a></li> <li class=""><a href="metamodel.ManagedType.html" class="nav-name">ManagedType</a></li> <li class=""><a href="metamodel.MapAttribute.html" class="nav-name">MapAttribute</a></li> <li class=""><a href="metamodel.Metamodel.html" class="nav-name">Metamodel</a></li> <li class=""><a href="metamodel.ModelBuilder.html" class="nav-name">ModelBuilder</a></li> <li class=""><a href="metamodel.PluralAttribute.html" class="nav-name">PluralAttribute</a></li> <li class=""><a href="metamodel.SetAttribute.html" class="nav-name">SetAttribute</a></li> <li class=""><a href="metamodel.SingularAttribute.html" class="nav-name">SingularAttribute</a></li> <li class=""><a href="metamodel.Type.html" class="nav-name">Type</a></li> </ul> </li> <li class=""> <a href="model.html" class="nav-name">model</a> <ul class="nav"> <li class=""><a href="model.Device.html" class="nav-name">Device</a></li> <li class=""><a href="model.Role.html" class="nav-name">Role</a></li> <li class=""><a href="model.User.html" class="nav-name">User</a></li> </ul> </li> <li class=""> <a href="partialupdate.html" class="nav-name">partialupdate</a> <ul class="nav"> <li class=""><a href="partialupdate.EntityPartialUpdateBuilder.html" class="nav-name">EntityPartialUpdateBuilder</a></li> <li class=""><a href="partialupdate.PartialUpdateBuilder.html" class="nav-name">PartialUpdateBuilder</a></li> <li class=""><a href="partialupdate.UpdateOperation.html" class="nav-name">UpdateOperation</a></li> </ul> </li> <li class="active"> <a href="query.html" class="nav-name">query</a> <ul class="nav"> <li class=""><a href="query.Builder.html" class="nav-name">Builder</a></li> <li class=""><a href="query.Filter.html" class="nav-name">Filter</a></li> <li class="active"><a href="query.Node.html" class="nav-name">Node</a></li> <li class=""><a href="query.Operator.html" class="nav-name">Operator</a></li> <li class=""><a href="query.Query.html" class="nav-name">Query</a></li> <li class=""><a href="query.Stream.html" class="nav-name">Stream</a></li> <li class=""><a href="query.Condition.html" class="nav-name">Condition</a></li> </ul> </li> <li class=""> <a href="util.html" class="nav-name">util</a> <ul class="nav"> <li class=""><a href="util.Code.html" class="nav-name">Code</a></li> <li class=""><a href="util.Lockable.html" class="nav-name">Lockable</a></li> <li class=""><a href="util.Logger.html" class="nav-name">Logger</a></li> <li class=""><a href="util.Metadata.html" class="nav-name">Metadata</a></li> <li class=""><a href="util.Modules.html" class="nav-name">Modules</a></li> <li class=""><a href="util.Permission.html" class="nav-name">Permission</a></li> <li class=""><a href="util.PushMessage.html" class="nav-name">PushMessage</a></li> <li class=""><a href="util.TokenStorage.html" class="nav-name">TokenStorage</a></li> <li class=""><a href="util.ValidationResult.html" class="nav-name">ValidationResult</a></li> <li class=""><a href="util.Validator.html" class="nav-name">Validator</a></li> <li class=""><a href="util.TokenStorageFactory.html" class="nav-name">TokenStorageFactory</a></li> </ul> </li> </ul> </div> <div class="col-md-12" id="main"> <div class="content"> <h1 class="page-title">Class: Node<T></h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span> <span class="ancestors"><a href="query.html">query</a>.</span>Node<T><span class="signature">(entityManager, resultClass)</span><span class="type-signature"></span></h2> <div class="class-description"><p>A Query Node saves the state of the query being built</p></div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="Node<T>"><span class="type-signature"></span>new Node<T><span class="signature">(entityManager, resultClass)</span><span class="type-signature"></span></h4> <h5>Parameters:</h5> <table class="params table"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>entityManager</code></td> <td class="type"> <span class="param-type"><a href="EntityManager.html">EntityManager</a></span> </td> <td class="description last"><p>The owning entity manager of this query</p></td> </tr> <tr> <td class="name"><code>resultClass</code></td> <td class="type"> <span class="param-type">Class.&lt;T></span> </td> <td class="description last"><p>The query result class</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Node.js.html">lib/query/Node.js</a>, <a href="lib_query_Node.js.html#line14">line 14</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Extends</h3> <ul> <li><a href="query.Query.html">query.Query</a></li> </ul> <h3 class="subsection-title">Members</h3> <h4 class="name" id="entityManager"><span class="type-signature">(readonly) </span>entityManager<span class="type-signature"> :<a href="EntityManager.html">EntityManager</a></span></h4> <div class="description"> <p>The owning EntityManager of this query</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type"><a href="EntityManager.html">EntityManager</a></span> </li> </ul> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#entityManager</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line14">line 14</a> </li></ul></dd> </dl> <h4 class="name" id="firstResult"><span class="type-signature">(readonly) </span>firstResult<span class="type-signature"> :number</span></h4> <div class="description"> <p>The offset how many results should be skipped</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">number</span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Node.js.html">lib/query/Node.js</a>, <a href="lib_query_Node.js.html#line27">line 27</a> </li></ul></dd> </dl> <h4 class="name" id="maxResults"><span class="type-signature">(readonly) </span>maxResults<span class="type-signature"> :number</span></h4> <div class="description"> <p>The limit how many objects should be returned</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">number</span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Node.js.html">lib/query/Node.js</a>, <a href="lib_query_Node.js.html#line34">line 34</a> </li></ul></dd> </dl> <h4 class="name" id="order"><span class="type-signature">(readonly) </span>order<span class="type-signature"> :Object.&lt;string, number></span></h4> <div class="description"> <p>The properties which should be used sort the result</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Object.&lt;string, number></span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Node.js.html">lib/query/Node.js</a>, <a href="lib_query_Node.js.html#line41">line 41</a> </li></ul></dd> </dl> <h4 class="name" id="resultClass"><span class="type-signature">(readonly) </span>resultClass<span class="type-signature"> :Class.&lt;T></span></h4> <div class="description"> <p>The result class of this query</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Class.&lt;T></span> </li> </ul> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#resultClass</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line21">line 21</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="ascending"><span class="type-signature"></span>ascending<span class="signature">(field)</span><span class="type-signature"> &rarr; {this}</span></h4> <div class="description"> <p>Add an ascending sort for the specified field to this query</p> </div> <h5>Parameters:</h5> <table class="params table"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>field</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The field to sort</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#ascending</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line29">line 29</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The resulting Query</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">this</span> </dd> </dl> <h4 class="name" id="count"><span class="type-signature"></span>count<span class="signature">(doneCallback<span class="signature-attributes">opt</span>, failCallback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;number>}</span></h4> <div class="description"> <p>Execute the query that returns the matching objects count.</p> </div> <h5>Parameters:</h5> <table class="params table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>doneCallback</code></td> <td class="type"> <span class="param-type"><a href="query.Query.html#~countCallback">query.Query~countCallback</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Called when the operation succeed.</p></td> </tr> <tr> <td class="name"><code>failCallback</code></td> <td class="type"> <span class="param-type"><a href="query.Query.html#~failCallback">query.Query~failCallback</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Called when there is a server-side error</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-overrides">Overrides:</dt> <dd class="tag-overrides"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#count</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line272">line 272</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The total number of matched objects</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.&lt;number></span> </dd> </dl> <h4 class="name" id="descending"><span class="type-signature"></span>descending<span class="signature">(field)</span><span class="type-signature"> &rarr; {this}</span></h4> <div class="description"> <p>Add an decending sort for the specified field to this query</p> </div> <h5>Parameters:</h5> <table class="params table"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>field</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The field to sort</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#descending</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line38">line 38</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The resulting Query</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">this</span> </dd> </dl> <h4 class="name" id="eventStream"><span class="type-signature"></span>eventStream<span class="signature">(onNext<span class="signature-attributes">opt</span>, onError<span class="signature-attributes">opt</span>, onComplete<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Subscription}</span></h4> <div class="description"> <p>Returns a subscription that handles change events for a real-time query.</p> <p>The underlying stream object is hidden. To create multiple subscriptions on the same stream, create the stream<br>object first and then subscribe to the stream (see the other signature <code>#eventStream(options)</code>).</p> </div> <h5>Parameters:</h5> <table class="params table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>onNext</code></td> <td class="type"> <span class="param-type"><a href="query.Query.html#~nextEventCallback">query.Query~nextEventCallback</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Called when an event is received</p></td> </tr> <tr> <td class="name"><code>onError</code></td> <td class="type"> <span class="param-type"><a href="query.Query.html#~failCallback">query.Query~failCallback</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Called when there is a server-side error</p></td> </tr> <tr> <td class="name"><code>onComplete</code></td> <td class="type"> <span class="param-type"><a href="query.Query.html#~completeCallback">query.Query~completeCallback</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Called when the network connection is closed (e.g. because of<br>lost Wi-Fi connection)</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-overrides">Overrides:</dt> <dd class="tag-overrides"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#eventStream</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line189">line 189</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>a real-time query subscription</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Subscription</span> </dd> </dl> <h4 class="name" id="limit"><span class="type-signature"></span>limit<span class="signature">(limit)</span><span class="type-signature"> &rarr; {this}</span></h4> <div class="description"> <p>Sets the limit of this query, i.e hox many objects should be returnd</p> </div> <h5>Parameters:</h5> <table class="params table"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>limit</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The limit of this query</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#limit</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line80">line 80</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="http://docs.mongodb.org/manual/reference/method/cursor.limit/">http://docs.mongodb.org/manual/reference/method/cursor.limit/</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The resulting Query</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">this</span> </dd> </dl> <h4 class="name" id="offset"><span class="type-signature"></span>offset<span class="signature">(offset)</span><span class="type-signature"> &rarr; {this}</span></h4> <div class="description"> <p>Sets the offset of the query, i.e. how many elements should be skipped</p> </div> <h5>Parameters:</h5> <table class="params table"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>offset</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The offset of this query</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#offset</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line65">line 65</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="http://docs.mongodb.org/manual/reference/method/cursor.skip/">http://docs.mongodb.org/manual/reference/method/cursor.skip/</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The resulting Query</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">this</span> </dd> </dl> <h4 class="name" id="resultList"><span class="type-signature"></span>resultList<span class="signature">(doneCallback<span class="signature-attributes">opt</span>, failCallback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Array.&lt;T>>}</span></h4> <div class="description"> <p>Execute the query and return the query results as a List</p> <p>Note: All local unsaved changes on matching objects, will be discarded.</p> </div> <h5>Parameters:</h5> <table class="params table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>doneCallback</code></td> <td class="type"> <span class="param-type"><a href="query.Query.html#~resultListCallback">query.Query~resultListCallback</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Called when the operation succeed.</p></td> </tr> <tr> <td class="name"><code>failCallback</code></td> <td class="type"> <span class="param-type"><a href="query.Query.html#~failCallback">query.Query~failCallback</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Called when the operation failed.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-overrides">Overrides:</dt> <dd class="tag-overrides"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#resultList</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line102">line 102</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A promise that will be resolved with the query result as a list</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.&lt;Array.&lt;T>></span> </dd> </dl> <h4 class="name" id="resultStream"><span class="type-signature"></span>resultStream<span class="signature">(onNext<span class="signature-attributes">opt</span>, onError<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Subscription}</span></h4> <div class="description"> <p>Returns a subscription that handles the complete real-time query result</p> <p>The full result is received initially (i.e. on subscription) and on every change.</p> <p>The underlying stream object is hidden. To create multiple subscriptions on the same stream, create the stream<br>object first and then subscribe to the stream (see the other signature <code>#resultStream(options)</code>).</p> <p>As the real-time query will reconnect infinitely often, there is no onComplete callback. (In other words, the<br>observable will never complete.)</p> </div> <h5>Parameters:</h5> <table class="params table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>onNext</code></td> <td class="type"> <span class="param-type"><a href="query.Query.html#~nextResultCallback">query.Query~nextResultCallback</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Called when the query result changes in any way</p></td> </tr> <tr> <td class="name"><code>onError</code></td> <td class="type"> <span class="param-type"><a href="query.Query.html#~failCallback">query.Query~failCallback</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Called when there is a server-side error</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-overrides">Overrides:</dt> <dd class="tag-overrides"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#resultStream</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line247">line 247</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>a real-time query subscription handling complete query results.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Subscription</span> </dd> </dl> <h4 class="name" id="singleResult"><span class="type-signature"></span>singleResult<span class="signature">(doneCallback<span class="signature-attributes">opt</span>, failCallback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;?T>}</span></h4> <div class="description"> <p>Execute the query that returns a single result</p> <p>Note: All local unsaved changes on the matched object, will be discarded.</p> </div> <h5>Parameters:</h5> <table class="params table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>doneCallback</code></td> <td class="type"> <span class="param-type"><a href="query.Query.html#~singleResultCallback">query.Query~singleResultCallback</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Called when the operation succeed.</p></td> </tr> <tr> <td class="name"><code>failCallback</code></td> <td class="type"> <span class="param-type"><a href="query.Query.html#~failCallback">query.Query~failCallback</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Called when the operation failed.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-overrides">Overrides:</dt> <dd class="tag-overrides"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#singleResult</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line129">line 129</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A promise that will be resolved with the query result as a single result</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.&lt;?T></span> </dd> </dl> <h4 class="name" id="sort"><span class="type-signature"></span>sort<span class="signature">(sort)</span><span class="type-signature"> &rarr; {this}</span></h4> <div class="description"> <p>Sets the sort of the query and discard all existing paramaters</p> </div> <h5>Parameters:</h5> <table class="params table"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>sort</code></td> <td class="type"> <span class="param-type">Object.&lt;string, number></span> </td> <td class="description last"><p>The new sort of the query which is an object whose keys are fields and the<br>values are either +1 for ascending order or -1 for descending order</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="query.Query.html">query.Query&lt;T>#sort</a> </li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_query_Query.js.html">lib/query/Query.js</a>, <a href="lib_query_Query.js.html#line50">line 50</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="http://docs.mongodb.org/manual/reference/method/cursor.sort/">http://docs.mongodb.org/manual/reference/method/cursor.sort/</a></li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The resulting Query</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">this</span> </dd> </dl> </article> </section> <!-- <footer> <strong>Baqend JavaScript SDK 2.14.1</strong><br> &copy 2019 Baqend GmbH<br> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun, 06 Jan 2019 05:00:24 GMT </footer> --> </div> </div> </div> </div> </div> <div id="footer" style="position:relative; z-index:1;"> <div class="container"> <d