UNPKG

prismic.io

Version:

JavaScript development kit for prismic.io

4,579 lines (1,239 loc) 58.3 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Namespace: Predicates</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 type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Namespace: Predicates</h1> <section> <header> <h2>Predicates</h2> </header> <article> <div class="container-overview"> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line25">line 25</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".any"><span class="type-signature">(static) </span>any<span class="signature">(fragment, values)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build an "any" predicate: equality of a fragment to a value. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>values</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line84">line 84</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.any("document.type", ["article", "blog-post"])</code></pre> <h4 class="name" id=".at"><span class="type-signature">(static) </span>at<span class="signature">(fragment, value)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build an "at" predicate: equality of a fragment to a value. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line46">line 46</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.at("document.type", "article")</code></pre> <h4 class="name" id=".dateAfter"><span class="type-signature">(static) </span>dateAfter<span class="signature">(fragment, after)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build a "date.after" predicate: documents where the fragment field is after the given date. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the name of the field - must be a date or timestamp field.</td> </tr> <tr> <td class="name"><code>after</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line165">line 165</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.dateAfter("my.product.releaseDate", new Date(2014, 1, 1))</code></pre> <h4 class="name" id=".dateBefore"><span class="type-signature">(static) </span>dateBefore<span class="signature">(fragment, before)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build a "date.before" predicate: documents where the fragment field is before the given date. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the name of the field - must be a date or timestamp field.</td> </tr> <tr> <td class="name"><code>before</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line155">line 155</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.dateBefore("my.product.releaseDate", new Date(2014, 6, 1))</code></pre> <h4 class="name" id=".dateBetween"><span class="type-signature">(static) </span>dateBetween<span class="signature">(fragment, before, after)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build a "date.between" predicate: combination of dateBefore and dateAfter </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the name of the field - must be a date or timestamp field.</td> </tr> <tr> <td class="name"><code>before</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>after</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line176">line 176</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.dateBetween("my.product.releaseDate", new Date(2014, 1, 1), new Date(2014, 6, 1))</code></pre> <h4 class="name" id=".dayOfMonth"><span class="type-signature">(static) </span>dayOfMonth<span class="signature">(fragment, day)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>day</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">between 1 and 31</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line185">line 185</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.dayOfMonth("my.product.releaseDate", 14)</code></pre> <h4 class="name" id=".dayOfMonthAfter"><span class="type-signature">(static) </span>dayOfMonthAfter<span class="signature">(fragment, day)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>day</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">between 1 and 31</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line194">line 194</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.dayOfMonthAfter("my.product.releaseDate", 14)</code></pre> <h4 class="name" id=".dayOfMonthBefore"><span class="type-signature">(static) </span>dayOfMonthBefore<span class="signature">(fragment, day)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>day</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">between 1 and 31</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line203">line 203</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.dayOfMonthBefore("my.product.releaseDate", 14)</code></pre> <h4 class="name" id=".dayOfWeek"><span class="type-signature">(static) </span>dayOfWeek<span class="signature">(fragment, day)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>day</code></td> <td class="type"> <span class="param-type">Number</span> | <span class="param-type">String</span> </td> <td class="description last">Number between 1 and 7 or string between "Monday" and "Sunday"</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line212">line 212</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.dayOfWeek("my.product.releaseDate", 14)</code></pre> <h4 class="name" id=".dayOfWeekAfter"><span class="type-signature">(static) </span>dayOfWeekAfter<span class="signature">(fragment, day)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>day</code></td> <td class="type"> <span class="param-type">Number</span> | <span class="param-type">String</span> </td> <td class="description last">Number between 1 and 7 or string between "Monday" and "Sunday"</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line221">line 221</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.dayOfWeekAfter("my.product.releaseDate", "Wednesday")</code></pre> <h4 class="name" id=".dayOfWeekBefore"><span class="type-signature">(static) </span>dayOfWeekBefore<span class="signature">(fragment, day)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>day</code></td> <td class="type"> <span class="param-type">Number</span> | <span class="param-type">String</span> </td> <td class="description last">Number between 1 and 7 or string between "Monday" and "Sunday"</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line230">line 230</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.dayOfWeekBefore("my.product.releaseDate", "Wednesday")</code></pre> <h4 class="name" id=".fulltext"><span class="type-signature">(static) </span>fulltext<span class="signature">(fragment, value)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build a "fulltext" predicate: fulltext search in a fragment. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the term to search</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line104">line 104</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.fulltext("my.article.body", "sausage"])</code></pre> <h4 class="name" id=".gt"><span class="type-signature">(static) </span>gt<span class="signature">(fragment, value)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build a "number.gt" predicate: documents where the fragment field is greater than the given value. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the name of the field - must be a number.</td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">the lower bound of the predicate</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line124">line 124</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.gt("my.product.price", 10)</code></pre> <h4 class="name" id=".has"><span class="type-signature">(static) </span>has<span class="signature">(fragment)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build a "has" predicate: documents where the requested field is defined </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line74">line 74</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.has("my.blog-post.author")</code></pre> <h4 class="name" id=".hour"><span class="type-signature">(static) </span>hour<span class="signature">(fragment, hour)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>hour</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line276">line 276</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.hour("my.product.releaseDate", 12)</code></pre> <h4 class="name" id=".hourAfter"><span class="type-signature">(static) </span>hourAfter<span class="signature">(fragment, hour)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>hour</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line294">line 294</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.hourAfter("my.product.releaseDate", 12)</code></pre> <h4 class="name" id=".hourBefore"><span class="type-signature">(static) </span>hourBefore<span class="signature">(fragment, hour)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>hour</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line285">line 285</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.hourBefore("my.product.releaseDate", 12)</code></pre> <h4 class="name" id=".in"><span class="type-signature">(static) </span>in<span class="signature">(fragment, values)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build an "in" predicate: equality of a fragment to a value. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>values</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line94">line 94</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.in("my.product.price", [4, 5])</code></pre> <h4 class="name" id=".inRange"><span class="type-signature">(static) </span>inRange<span class="signature">(fragment, before, after)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build a "number.inRange" predicate: combination of lt and gt. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the name of the field - must be a number.</td> </tr> <tr> <td class="name"><code>before</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>after</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line145">line 145</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.inRange("my.product.price", 10, 20)</code></pre> <h4 class="name" id=".lt"><span class="type-signature">(static) </span>lt<span class="signature">(fragment, value)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build a "number.lt" predicate: documents where the fragment field is lower than the given value. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the name of the field - must be a number.</td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">the upper bound of the predicate</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line134">line 134</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.lt("my.product.price", 20)</code></pre> <h4 class="name" id=".missing"><span class="type-signature">(static) </span>missing<span class="signature">(fragment)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build a "missing" predicate: documents where the requested field is empty </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line65">line 65</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> an array corresponding to the predicate </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.missing("my.blog-post.author")</code></pre> <h4 class="name" id=".month"><span class="type-signature">(static) </span>month<span class="signature">(fragment, month)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>month</code></td> <td class="type"> <span class="param-type">Number</span> | <span class="param-type">String</span> </td> <td class="description last">Number between 1 and 12 or string between "January" and "December"</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line239">line 239</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.month("my.product.releaseDate", "June")</code></pre> <h4 class="name" id=".monthAfter"><span class="type-signature">(static) </span>monthAfter<span class="signature">(fragment, month)</span><span class="type-signature"> &rarr; {Array|Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>month</code></td> <td class="type"> <span class="param-type">Number</span> | <span class="param-type">String</span> </td> <td class="description last">Number between 1 and 12 or string between "January" and "December"</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line258">line 258</a> </li></ul></dd> </dl> <h5>Returns:</h5> <ul> <li> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> </li> <li> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> </li> </ul> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.monthAfter("my.product.releaseDate", "June")</code></pre> <h4 class="name" id=".monthBefore"><span class="type-signature">(static) </span>monthBefore<span class="signature">(fragment, month)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>month</code></td> <td class="type"> <span class="param-type">Number</span> | <span class="param-type">String</span> </td> <td class="description last">Number between 1 and 12 or string between "January" and "December"</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line248">line 248</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.monthBefore("my.product.releaseDate", "June")</code></pre> <h4 class="name" id=".near"><span class="type-signature">(static) </span>near<span class="signature">(fragment, latitude, longitude, radius)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fragment</code></td> <td class="type"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>latitude</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>longitude</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>radius</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">in kilometers</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="predicates.js.html">predicates.js</a>, <a href="predicates.js.html#line305">line 305</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>Predicates.near("my.store.location", 48.8768767, 2.3338802, 10)</code></pre> <h4 class="name" id=".not"><span class="type-signature">(static) </span>not<span class="signature">(fragment, value)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Build an "not" predicate: inequality of a fragment to a value. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th>