UNPKG

json-odm

Version:

Object document mapper for JSON data that provides mongodb methods for querying and transformation as well as additional joining that is not provided by mongodb. >> IF YOU LIKE IT, PLEASE GIVE IT A STAR ON GITHUB <<

4,410 lines (1,286 loc) 85.5 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Documentation Namespace: Query</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> <link type="text/css" rel="stylesheet" href="styles/site.cerulean.css"> </head> <body> <div class="navbar navbar-default navbar-fixed-top "> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="index.html">Documentation</a> <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="navbar-collapse collapse" id="topNavigation"> <ul class="nav navbar-nav"> <li class="dropdown"> <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> <ul class="dropdown-menu "> <li><a href="JsonOdm.html">JsonOdm</a></li><li><a href="jsonOdm.Collection.html">jsonOdm.Collection</a></li><li><a href="jsonOdm.Geo.html">jsonOdm.Geo</a></li><li><a href="jsonOdm.Geo.BoundaryBox.html">jsonOdm.Geo.BoundaryBox</a></li><li><a href="jsonOdm.Geo.Feature.html">jsonOdm.Geo.Feature</a></li><li><a href="jsonOdm.Geo.FeatureCollection.html">jsonOdm.Geo.FeatureCollection</a></li><li><a href="jsonOdm.Geo.GeometryCollection.html">jsonOdm.Geo.GeometryCollection</a></li><li><a href="jsonOdm.Geo.LineString.html">jsonOdm.Geo.LineString</a></li><li><a href="jsonOdm.Geo.MultiLineString.html">jsonOdm.Geo.MultiLineString</a></li><li><a href="jsonOdm.Geo.MultiPoint.html">jsonOdm.Geo.MultiPoint</a></li><li><a href="jsonOdm.Geo.MultiPolygon.html">jsonOdm.Geo.MultiPolygon</a></li><li><a href="jsonOdm.Geo.Point.html">jsonOdm.Geo.Point</a></li><li><a href="jsonOdm.Geo.Polygon.html">jsonOdm.Geo.Polygon</a></li><li><a href="jsonOdm.Query.html">jsonOdm.Query</a></li><li><a href="jsonOdm.Util.html">jsonOdm.Util</a></li> </ul> </li> </ul> <div class="col-sm-3 col-md-3"> <form class="navbar-form" role="search"> <div class="input-group"> <input type="text" class="form-control" placeholder="Search" name="q" id="search-input"> <div class="input-group-btn"> <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button> </div> </div> </form> </div> </div> </div> </div> <div class="container" id="toc-content"> <div class="row"> <div class="col-md-8"> <div id="main"> <h1 class="page-title">Namespace: Query</h1> <section> <header> <h2> Query </h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <h3 class="subsection-title">Methods</h3> <dl> <hr> <dt> <h4 class="name" id="$accumulator"><span class="type-signature"></span>$accumulator(nodes, accumulator)</h4> </dt> <dd> <div class="description"> <p>Go down the property tree of the collection</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>nodes</code></td> <td class="type"> <span class="param-type">Array.&lt;String></span> </td> <td class="description last"><p>A variable of nodes to traverse down the json tree</p></td> </tr> <tr> <td class="name"><code>accumulator</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$add"><span class="type-signature"></span>$add(branch1, branch2)</h4> </dt> <dd> <div class="description"> <p>Performs an arithmetic addition on two or more field values</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>branch1</code></td> <td class="type"> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> | <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>branch2</code></td> <td class="type"> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> | <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>jsonOdm.Query</p> </div> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var collection = new jsonOdm.Collection(&quot;myCollection&quot;); var $query = collection.$query(); $query.$add( $query.$branch(&quot;firstValue&quot;), $query.$subtract( $query.$branch(&quot;lastValue&quot;), $query.$branch([&quot;otherValues&quot;,&quot;firstValue&quot;]) ) ).$eq(12).$all();</pre> </dd> <hr> <dt> <h4 class="name" id="$aggregateCollection"><span class="type-signature"></span>$aggregateCollection(afterValidation [, beforeCollect] [, aggregation])</h4> </dt> <dd> <div class="description"> <p>Helper method for aggregation methods</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>afterValidation</code></td> <td class="type"> <span class="param-type">Array.&lt;function()></span> | <span class="param-type">function</span> </td> <td class="attributes"> </td> <td class="description last"><p>Push into the query queue after all commands have been executed. Returning false will result in a skip of this value</p></td> </tr> <tr> <td class="name"><code>beforeCollect</code></td> <td class="type"> <span class="param-type">Array.&lt;function()></span> | <span class="param-type">function</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Push into the before collect queue to change or replace the collection element</p></td> </tr> <tr> <td class="name"><code>aggregation</code></td> <td class="type"> <span class="param-type">Array.&lt;function()></span> | <span class="param-type">function</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>If the result of the whole aggregation changes, i.e. for searching, or ordering</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$all"><span class="type-signature"></span>$all()</h4> </dt> <dd> <div class="description"> <p>Returns a collection containing all matching elements</p> </div> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Collection.html">jsonOdm.Collection</a></span> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var collection = new jsonOdm.Collection(&quot;myCollection&quot;); collection.$query() .$branch(&quot;id&quot;).$eq(2,9) .$all();</pre> </dd> <hr> <dt> <h4 class="name" id="$and"><span class="type-signature"></span>$and(queries)</h4> </dt> <dd> <div class="description"> <p>Compares sub query results using the boolean and</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>queries</code></td> <td class="type"> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </td> <td class="attributes"> &lt;repeatable><br> </td> <td class="description last"><p>A finite number of operators</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$avg"><span class="type-signature"></span>$avg(branch)</h4> </dt> <dd> <div class="description"> <p>Performs the accumulation average of a field. It's integrated to be used with $group. May as well be used as stand alone.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>branch</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;repeatable><br> </td> <td class="description last"><p>Internally calls the $branch method to receive the field values</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">// SHOULD BE USED WITH $group var collection = new jsonOdm.Collection(&quot;employees&quot;); var $query = collection.$query(); $query.$avg(&quot;daysOff&quot;).$all(); console.log($query.$$accumulation);</pre> </dd> <hr> <dt> <h4 class="name" id="$branch"><span class="type-signature"></span>$branch(node)</h4> </dt> <dd> <div class="description"> <p>Go down the property tree of the collection</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>node</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;repeatable><br> </td> <td class="description last"><p>A variable amount of nodes to traverse down the document tree</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$count"><span class="type-signature"></span>$count()</h4> </dt> <dd> <div class="description"> <p>Counts the grouped elements</p> </div> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">// SHOULD BE USED WITH $group var collection = new jsonOdm.Collection(&quot;employees&quot;); var $query = collection.$count(); $query.$count(&quot;daysOff&quot;).$all(); expect(collection.length).toBe($query.$$accumulation);</pre> </dd> <hr> <dt> <h4 class="name" id="$delete"><span class="type-signature"></span>$delete()</h4> </dt> <dd> <div class="description"> <p>Returns a collection containing all matching elements</p> </div> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var collection = new jsonOdm.Collection(&quot;myCollection&quot;); collection.$query() .$branch(&quot;id&quot;).$gt(500) .$delete();</pre> </dd> <hr> <dt> <h4 class="name" id="$divide"><span class="type-signature"></span>$divide(branch)</h4> </dt> <dd> <div class="description"> <p>Performs an arithmetic divition on two or more field values</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>branch</code></td> <td class="type"> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> | <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>jsonOdm.Query</p> </div> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var collection = new jsonOdm.Collection(&quot;myCollection&quot;); var $query = collection.$query(); $query.$divide( $query.$branch(&quot;firstValue&quot;), $query.$add( $query.$branch(&quot;lastValue&quot;), $query.$branch([&quot;otherValues&quot;,&quot;firstValue&quot;]) ) ).$eq(12).$all();</pre> </dd> <hr> <dt> <h4 class="name" id="$eq"><span class="type-signature"></span>$eq(comparable)</h4> </dt> <dd> <div class="description"> <p>Compares the current sub collection value with the comparable like this $eq('1','2','4') so 1 or 2 or 4 are valid fields</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>comparable</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="attributes"> &lt;repeatable><br> </td> <td class="description last"><p>Values to compare the current field with</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$exists"><span class="type-signature"></span>$exists()</h4> </dt> <dd> <div class="description"> <p>Compares the current sub collection value to not be undefined</p> </div> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$first"><span class="type-signature"></span>$first()</h4> </dt> <dd> <div class="description"> <p>Short hand version for $all(true)</p> </div> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Collection.html">jsonOdm.Collection</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$geoIntersects"><span class="type-signature"></span>$geoIntersects(geometry)</h4> </dt> <dd> <div class="description"> <p>Checks whether the current field geometry intersects the given geometry object <br/> <strong style="color:#ff0000">Warning:</strong> The coordinate reference system is <a href="http://spatialreference.org/ref/epsg/4326/" target="_blank">WGS 84</a>witch uses the coordinate order [<strong>longitude</strong>,<strong>latitude</strong>]!<br/> The method automatically transforms arrays into the assumed GeoJSON definitions where: <br/> [10,10] transforms into a jsonOdm.Geo.Point <br/> [[10,10],[10,12],...] transforms into a jsonOdm.Geo.LineString <br/> [[[10,10],[10,12],...],...] transforms into a jsonOdm.Geo.Polygon <br/> [[[[10,10],[10,12],...],...],...] transforms into a jsonOdm.Geo.MultiPolygon <br/> or simply use a GeoJSON object definition from jsonOdm.Geo</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>geometry</code></td> <td class="type"> <span class="param-type">Array</span> | <span class="param-type"><a href="jsonOdm.Geo.BoundaryBox.html">jsonOdm.Geo.BoundaryBox</a></span> | <span class="param-type"><a href="jsonOdm.Geo.Point.html">jsonOdm.Geo.Point</a></span> | <span class="param-type"><a href="jsonOdm.Geo.MultiPoint.html">jsonOdm.Geo.MultiPoint</a></span> | <span class="param-type"><a href="jsonOdm.Geo.LineString.html">jsonOdm.Geo.LineString</a></span> | <span class="param-type"><a href="jsonOdm.Geo.MultiLineString.html">jsonOdm.Geo.MultiLineString</a></span> | <span class="param-type"><a href="jsonOdm.Geo.Polygon.html">jsonOdm.Geo.Polygon</a></span> | <span class="param-type"><a href="jsonOdm.Geo.MultiPolygon.html">jsonOdm.Geo.MultiPolygon</a></span> | <span class="param-type"><a href="jsonOdm.Geo.GeometryCollection.html">jsonOdm.Geo.GeometryCollection</a></span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">{ &quot;geo&quot;:[ { &quot;type&quot;: &quot;Feature&quot;, &quot;properties&quot;: {...}, &quot;geometry&quot;: { &quot;type&quot;: &quot;Polygon&quot;, &quot;coordinates&quot;: [ ... ] } }, { &quot;type&quot;: &quot;Feature&quot;, &quot;properties&quot;: {...}, &quot;geometry&quot;: { &quot;type&quot;: &quot;Polygon&quot;, &quot;coordinates&quot;: [ ... ] } }, ... ] } var collection = new jsonOdm.Collection(&quot;geo&quot;), q = collection.$query().$branch(&quot;geometry&quot;).$geoIntersects(new jsonOdm.Geo.BoundaryBox([129.049317,-31.434555,139.464356,-19.068644])); //found geometries geometries = q.$all();</pre> </dd> <hr> <dt> <h4 class="name" id="$geoWithin"><span class="type-signature"></span>$geoWithin(geometry)</h4> </dt> <dd> <div class="description"> <p>Checks whether the current field geometry is within the given geometry object <br/> <strong style="color:#ff0000">Warning:</strong> The coordinate reference system is <a href="http://spatialreference.org/ref/epsg/4326/" target="_blank">WGS 84</a>witch uses the coordinate order [<strong>longitude</strong>,<strong>latitude</strong>]!<br/> The method automatically transforms arrays into the assumed GeoJSON definitions where: <br/> [10,10] transforms into a jsonOdm.Geo.Point <br/> [[10,10],[10,12],...] transforms into a jsonOdm.Geo.LineString <br/> [[[10,10],[10,12],...],...] transforms into a jsonOdm.Geo.Polygon <br/> [[[[10,10],[10,12],...],...],...] transforms into a jsonOdm.Geo.MultiPolygon <br/> or simply use a GeoJSON object definition from jsonOdm.Geo</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>geometry</code></td> <td class="type"> <span class="param-type">Array</span> | <span class="param-type"><a href="jsonOdm.Geo.BoundaryBox.html">jsonOdm.Geo.BoundaryBox</a></span> | <span class="param-type"><a href="jsonOdm.Geo.Point.html">jsonOdm.Geo.Point</a></span> | <span class="param-type"><a href="jsonOdm.Geo.MultiPoint.html">jsonOdm.Geo.MultiPoint</a></span> | <span class="param-type"><a href="jsonOdm.Geo.LineString.html">jsonOdm.Geo.LineString</a></span> | <span class="param-type"><a href="jsonOdm.Geo.MultiLineString.html">jsonOdm.Geo.MultiLineString</a></span> | <span class="param-type"><a href="jsonOdm.Geo.Polygon.html">jsonOdm.Geo.Polygon</a></span> | <span class="param-type"><a href="jsonOdm.Geo.MultiPolygon.html">jsonOdm.Geo.MultiPolygon</a></span> | <span class="param-type"><a href="jsonOdm.Geo.GeometryCollection.html">jsonOdm.Geo.GeometryCollection</a></span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">{ &quot;geo&quot;:[ { &quot;type&quot;: &quot;Feature&quot;, &quot;properties&quot;: {...}, &quot;geometry&quot;: { &quot;type&quot;: &quot;Polygon&quot;, &quot;coordinates&quot;: [ ... ] } }, { &quot;type&quot;: &quot;Feature&quot;, &quot;properties&quot;: {...}, &quot;geometry&quot;: { &quot;type&quot;: &quot;Polygon&quot;, &quot;coordinates&quot;: [ ... ] } }, ... ] } var collection = new jsonOdm.Collection(&quot;geo&quot;), q = collection.$query().$branch(&quot;geometry&quot;).$geoWithin(new jsonOdm.Geo.BoundaryBox([129.049317,-31.434555,139.464356,-19.068644])); //found geometries geometries = q.$all();</pre> </dd> <hr> <dt> <h4 class="name" id="$group"><span class="type-signature"></span>$group()</h4> </dt> <dd> <div class="description"> <p>Groups all elements of a collection by a given grouping schema</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="type"> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </td> <td class="attributes"> &lt;repeatable><br> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var collection = new jsonOdm.Collection(&quot;employees&quot;); var $query = collection.$query(); var groupedResult = $query.$and($query.$branch(&quot;age&quot;).$gt(21),$query.$branch(&quot;age&quot;).$lt(50)) // query before grouping .$group( &quot;salaryRate&quot;, // as used with $branch [&quot;salaryGroup&quot;,&quot;name&quot;], // as used with $branch // A projection object defining the accumulation { missingDays:$query.$sum(&quot;daysAtHome&quot;), holidayDays:$query.$sum(&quot;daysOnHoliday&quot;), averageMissingDays:$query.$avg(&quot;daysAtHome&quot;), averageHolidayDays:$query.$avg(&quot;daysOnHoliday&quot;), count:$query.$count() } ).$all(); // RESULT COULD BE // [ // {&quot;salaryRate&quot;:3300,&quot;salaryGroup&quot;:{&quot;name&quot;:&quot;Developer&quot;},&quot;missingDays&quot;:22,&quot;holidayDays&quot;:144,&quot;averageMissingDays&quot;:11,&quot;averageHolidayDays&quot;:72,&quot;count&quot;:2}, // {&quot;salaryRate&quot;:2800,&quot;salaryGroup&quot;:{&quot;name&quot;:&quot;Tester&quot;} ,&quot;missingDays&quot;:10,&quot;holidayDays&quot;:66 ,&quot;averageMissingDays&quot;:5, &quot;averageHolidayDays&quot;:33,&quot;count&quot;:2}, // {&quot;salaryRate&quot;:4800,&quot;salaryGroup&quot;:{&quot;name&quot;:&quot;Boss&quot;} ,&quot;missingDays&quot;:12,&quot;holidayDays&quot;:33 ,&quot;averageMissingDays&quot;:12,&quot;averageHolidayDays&quot;:33,&quot;count&quot;:1} // ]</pre> </dd> <hr> <dt> <h4 class="name" id="$gt"><span class="type-signature"></span>$gt(comparable)</h4> </dt> <dd> <div class="description"> <p>Compares the current sub collection value with the comparable like this $gt('1') field values greater then 1 are valid</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>comparable</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"><p>Values to compare the current field with</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$gte"><span class="type-signature"></span>$gte(comparable)</h4> </dt> <dd> <div class="description"> <p>Compares the current sub collection value with the comparable like this $gte('1') field values greater then or equal to 1 are valid</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>comparable</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"><p>Values to compare the current field with</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$in"><span class="type-signature"></span>$in(comparable)</h4> </dt> <dd> <div class="description"> <p>Compares the current sub collection value with the comparable like this $in(['1','2','4']) so 1 or 2 or 4 are valid fields</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>comparable</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last"><p>Values to compare the current field with</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$isNull"><span class="type-signature"></span>$isNull()</h4> </dt> <dd> <div class="description"> <p>Compares the current sub collection value to be null or undefined</p> </div> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$lt"><span class="type-signature"></span>$lt(comparable)</h4> </dt> <dd> <div class="description"> <p>Compares the current sub collection value with the comparable like this $lt('1') field values less then 1 are valid</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>comparable</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"><p>Values to compare the current field with</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$lte"><span class="type-signature"></span>$lte(comparable)</h4> </dt> <dd> <div class="description"> <p>Compares the current sub collection value with the comparable like this $lte('1') field values less then or equal to 1 are valid</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>comparable</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"><p>Values to compare the current field with</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$max"><span class="type-signature"></span>$max(branch)</h4> </dt> <dd> <div class="description"> <p>Performs the accumulation max of a field. It's integrated to be used with $group. May as well be used as stand alone.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>branch</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;repeatable><br> </td> <td class="description last"><p>Internally calls the $branch method to receive the field values</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">// SHOULD BE USED WITH $group var collection = new jsonOdm.Collection(&quot;employees&quot;); var $query = collection.$query(); $query.$max(&quot;daysOff&quot;).$all(); console.log($query.$$accumulation);</pre> </dd> <hr> <dt> <h4 class="name" id="$min"><span class="type-signature"></span>$min(branch)</h4> </dt> <dd> <div class="description"> <p>Performs the accumulation min of a field. It's integrated to be used with $group. May as well be used as stand alone.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>branch</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;repeatable><br> </td> <td class="description last"><p>Internally calls the $branch method to receive the field values</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">// SHOULD BE USED WITH $group var collection = new jsonOdm.Collection(&quot;employees&quot;); var $query = collection.$query(); $query.$max(&quot;daysOff&quot;).$all(); console.log($query.$$accumulation);</pre> </dd> <hr> <dt> <h4 class="name" id="$mod"><span class="type-signature"></span>$mod()</h4> </dt> <dd> <div class="description"> <p>Compares the given reminder against the selected field value modulo the given divisor</p> </div> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var collection = new jsonOdm.Collection(&quot;myCollection&quot;); collection.$query() // get every fourth element, so elements with id 4,8,12,... when starting with id 1 .$branch(&quot;id&quot;).$mod(4,0) .$all();</pre> </dd> <hr> <dt> <h4 class="name" id="$modifyField"><span class="type-signature"></span>$modifyField()</h4> </dt> <dd> <div class="description"> <p>Modify fields before validation</p> </div> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="$modulo"><span class="type-signature"></span>$modulo(branch, module)</h4> </dt> <dd> <div class="description"> <p>Performs an arithmetic modulo on two or more field values</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>branch</code></td> <td class="type"> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> | <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>module</code></td> <td class="type"> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> | <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>jsonOdm.Query</p> </div> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var collection = new jsonOdm.Collection(&quot;myCollection&quot;); var $query = collection.$query(); $query.$modulo( $query.$branch(&quot;firstValue&quot;), $query.$add( $query.$branch(&quot;lastValue&quot;), $query.$branch([&quot;otherValues&quot;,&quot;firstValue&quot;]) ) ).$eq(12).$all();</pre> </dd> <hr> <dt> <h4 class="name" id="$multiply"><span class="type-signature"></span>$multiply(branch)</h4> </dt> <dd> <div class="description"> <p>Performs an arithmetic multiplication on two or more field values</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>branch</code></td> <td class="type"> <span class="param-type"><a href="jsonOdm.Query.html">jsonOdm.Query</a></span> | <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>jsonOdm.Query</p> </div> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var collection = new jsonOdm.Collection(&quot;myCollection&quot;); var $query = collection.$query(); $query.$multiply( $query.$branch(&quot;firstValue&quot;), $query.$add( $query.$branch(&quot;lastValue&quot;), $query.$branch([&quot;otherValues&quot;,&quot;firstValue&quot;]) ) ).$eq(12).$all();</pre> </dd> <hr> <dt> <h4 class="name" id="$nand"><span class="type-signature"></span>$nand(queries)</h4> </dt> <dd> <div class="description"> <p>Compares sub query results using the boolean nand</p> </div> <h5>Parameters: