morefun-forerunnerdb
Version:
A NoSQL document store database for browsers and Node.js.
4,221 lines (1,094 loc) • 132 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Collection</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">Class: Collection</h1>
<section>
<header>
<h2>Collection</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Collection"><span class="type-signature"></span>new Collection<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Creates a new collection. Collections store multiple documents and
handle CRUD against those documents.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line23">line 23</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="areaChart"><span class="type-signature"></span>areaChart<span class="type-signature"> :<a href="Overload.html">Overload</a></span></h4>
<div class="description">
Creates an area chart from the collection.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="Overload.html">Overload</a></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Highchart.js.html">Highchart.js</a>, <a href="Highchart.js.html#line453">line 453</a>
</li></ul></dd>
</dl>
<h4 class="name" id="barChart"><span class="type-signature"></span>barChart<span class="type-signature"> :<a href="Overload.html">Overload</a></span></h4>
<div class="description">
Creates a bar chart from the collection.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="Overload.html">Overload</a></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Highchart.js.html">Highchart.js</a>, <a href="Highchart.js.html#line553">line 553</a>
</li></ul></dd>
</dl>
<h4 class="name" id="columnChart"><span class="type-signature"></span>columnChart<span class="type-signature"> :<a href="Overload.html">Overload</a></span></h4>
<div class="description">
Creates a column chart from the collection.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="Overload.html">Overload</a></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Highchart.js.html">Highchart.js</a>, <a href="Highchart.js.html#line503">line 503</a>
</li></ul></dd>
</dl>
<h4 class="name" id="lineChart"><span class="type-signature"></span>lineChart<span class="type-signature"> :<a href="Overload.html">Overload</a></span></h4>
<div class="description">
Creates a line chart from the collection.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="Overload.html">Overload</a></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Highchart.js.html">Highchart.js</a>, <a href="Highchart.js.html#line392">line 392</a>
</li></ul></dd>
</dl>
<h4 class="name" id="pieChart"><span class="type-signature"></span>pieChart<span class="type-signature"> :<a href="Overload.html">Overload</a></span></h4>
<div class="description">
Creates a pie chart from the collection.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="Overload.html">Overload</a></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Highchart.js.html">Highchart.js</a>, <a href="Highchart.js.html#line342">line 342</a>
</li></ul></dd>
</dl>
<h4 class="name" id="stackedBarChart"><span class="type-signature"></span>stackedBarChart<span class="type-signature"> :<a href="Overload.html">Overload</a></span></h4>
<div class="description">
Creates a stacked bar chart from the collection.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="Overload.html">Overload</a></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Highchart.js.html">Highchart.js</a>, <a href="Highchart.js.html#line603">line 603</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".collateAdd"><span class="type-signature">(static) </span>collateAdd<span class="signature">(collection, keyName<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Adds a data source to collate data from and specifies the
key name to collate data to.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>collection</code></td>
<td class="type">
<span class="param-type"><a href="Collection.html">Collection</a></span>
</td>
<td class="attributes">
</td>
<td class="description last">The collection to collate data from.</td>
</tr>
<tr>
<td class="name"><code>keyName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional name of the key to collate data to.
If none is provided the record CRUD is operated on the root collection
data.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line3448">line 3448</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".collateAdd"><span class="type-signature">(static) </span>collateAdd<span class="signature">(collection, process)</span><span class="type-signature"></span></h4>
<div class="description">
Adds a data source to collate data from and specifies a process
method that will handle the collation functionality (for custom
collation).
</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>collection</code></td>
<td class="type">
<span class="param-type"><a href="Collection.html">Collection</a></span>
</td>
<td class="description last">The collection to collate data from.</td>
</tr>
<tr>
<td class="name"><code>process</code></td>
<td class="type">
<span class="param-type"><a href="global.html#function">function</a></span>
</td>
<td class="description last">The process method.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line3513">line 3513</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".grid"><span class="type-signature">(static) </span>grid<span class="signature">(selector, template, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Creates a grid and assigns the collection as its data source.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>selector</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">jQuery selector of grid output target.</td>
</tr>
<tr>
<td class="name"><code>template</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">The table template to use when rendering the grid.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The options object to apply to the grid.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Grid.js.html">Grid.js</a>, <a href="Grid.js.html#line530">line 530</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id=".isLinked"><span class="type-signature">(static) </span>isLinked<span class="signature">()</span><span class="type-signature"> → {Boolean}</span></h4>
<div class="description">
Checks if the instance is data-bound to any DOM elements.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="AutoBind.js.html">AutoBind.js</a>, <a href="AutoBind.js.html#line45">line 45</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if linked, false if not.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id=".link"><span class="type-signature">(static) </span>link<span class="signature">(scope, varName, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Creates a link to the DOM between the collection data and the elements
in the passed output selector. When new elements are needed or changes
occur the passed templateSelector is used to get the template that is
output to the DOM.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>scope</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>varName</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional extra options.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Angular.js.html">Angular.js</a>, <a href="Angular.js.html#line106">line 106</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li>unlink</li>
</ul>
</dd>
</dl>
<h4 class="name" id=".link"><span class="type-signature">(static) </span>link<span class="signature">(outputTargetSelector, templateSelector, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Creates a link to the DOM between the collection data and the elements
in the passed output selector. When new elements are needed or changes
occur the passed templateSelector is used to get the template that is
output to the DOM.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>outputTargetSelector</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>templateSelector</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional extra options.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="AutoBind.js.html">AutoBind.js</a>, <a href="AutoBind.js.html#line55">line 55</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li>unlink</li>
</ul>
</dd>
</dl>
<h4 class="name" id=".link"><span class="type-signature">(static) </span>link<span class="signature">(scope, varName, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Creates a link to the DOM between the collection data and the elements
in the passed output selector. When new elements are needed or changes
occur the passed templateSelector is used to get the template that is
output to the DOM.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>scope</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>varName</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional extra options.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Angular.js.html">Angular.js</a>, <a href="Angular.js.html#line28">line 28</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li>unlink</li>
</ul>
</dd>
</dl>
<h4 class="name" id=".unGrid"><span class="type-signature">(static) </span>unGrid<span class="signature">(selector, template, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Removes a grid safely from the DOM. Must be called when grid is
no longer required / is being removed from DOM otherwise references
will stick around and cause memory leaks.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>selector</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">jQuery selector of grid output target.</td>
</tr>
<tr>
<td class="name"><code>template</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">The table template to use when rendering the grid.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The options object to apply to the grid.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Grid.js.html">Grid.js</a>, <a href="Grid.js.html#line566">line 566</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id=".unlink"><span class="type-signature">(static) </span>unlink<span class="signature">(outputTargetSelector, templateSelector)</span><span class="type-signature"></span></h4>
<div class="description">
Removes a link to the DOM between the collection data and the elements
in the passed output selector that was created using the link() method.
</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>outputTargetSelector</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>templateSelector</code></td>
<td class="type">
</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="AutoBind.js.html">AutoBind.js</a>, <a href="AutoBind.js.html#line185">line 185</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_insertHandle"><span class="type-signature"></span>_insertHandle<span class="signature">(data, index<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Inserts a document or array of documents into the collection.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Object</span>
|
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="description last">Either a document object or array of document</td>
</tr>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional index to insert the record at.</td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type"><a href="Collection.html#~insertCallback">Collection~insertCallback</a></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional callback called
once the insert is complete.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line1672">line 1672</a>
</li></ul></dd>
</dl>
<h4 class="name" id="count"><span class="type-signature"></span>count<span class="signature">()</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
Returns the number of documents currently in the collection.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line3152">line 3152</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="data"><span class="type-signature"></span>data<span class="signature">()</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
Get the data array that represents the collection's data.
This data is returned by reference and should not be altered outside
of the provided CRUD functionality of the collection as doing so
may cause unstable index behaviour within the collection.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line187">line 187</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="diff"><span class="type-signature"></span>diff<span class="signature">(collection)</span><span class="type-signature"> → {Object}</span></h4>
<div class="description">
Generates a difference object that contains insert, update and remove arrays
representing the operations to execute to make this collection have the same
data as the one passed.
</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>collection</code></td>
<td class="type">
<span class="param-type"><a href="Collection.html">Collection</a></span>
</td>
<td class="description last">The collection to diff against.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line3384">line 3384</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="distinct"><span class="type-signature"></span>distinct<span class="signature">(key, query<span class="signature-attributes">opt</span>, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
Find the distinct values for a specified field across a single collection and
returns the results in an array.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">The field path to return distinct values for e.g. "person.name".</td>
</tr>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The query to use to filter the documents used to return values from.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The query options to use when running the query.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line1994">line 1994</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="drop"><span class="type-signature"></span>drop<span class="signature">(callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="global.html#boolean">boolean</a>}</span></h4>
<div class="description">
Drops a collection and all it's stored data from the database.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type"><a href="global.html#function">function</a></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">A callback method to call once the
operation has completed.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line197">line 197</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True on success, false on failure.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#boolean">boolean</a></span>
</dd>
</dl>
<h4 class="name" id="dropChart"><span class="type-signature"></span>dropChart<span class="signature">(selector)</span><span class="type-signature"></span></h4>
<div class="description">
Removes a chart from the page by it's selector.
</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>selector</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The chart selector.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Highchart.js.html">Highchart.js</a>, <a href="Highchart.js.html#line658">line 658</a>
</li></ul></dd>
</dl>
<h4 class="name" id="ensureIndex"><span class="type-signature"></span>ensureIndex<span class="signature">(keys, options)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Creates an index on the specified keys.
</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>keys</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The object containing keys to index.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">An options object.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line3287">line 3287</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="explain"><span class="type-signature"></span>explain<span class="signature">(query, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Object}</span></h4>
<div class="description">
Provides a query plan / operations log for a query.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last">The query to execute.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional options object.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line2073">line 2073</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The query plan.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="filter"><span class="type-signature"></span>filter<span class="signature">(query, func, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
Executes a method against each document that matches query and returns an
array of documents that may have been modified by the method.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last">The query object.</td>
</tr>
<tr>
<td class="name"><code>func</code></td>
<td class="type">
<span class="param-type"><a href="global.html#function">function</a></span>
</td>
<td class="attributes">
</td>
<td class="description last">The method that each document is passed to. If this method
returns false for a particular document it is excluded from the results.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional options object.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line674">line 674</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="filterUpdate"><span class="type-signature"></span>filterUpdate<span class="signature">(query, func, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
Executes a method against each document that matches query and then executes
an update based on the return data of the method.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last">The query object.</td>
</tr>
<tr>
<td class="name"><code>func</code></td>
<td class="type">
<span class="param-type"><a href="global.html#function">function</a></span>
</td>
<td class="attributes">
</td>
<td class="description last">The method that each document is passed to. If this method
returns false for a particular document it is excluded from the update.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional options object passed to the initial find call.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Collection.js.html">Collection.js</a>, <a href="Collection.js.html#line687">line 687</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="find"><span class="type-signature"></span>find<span class="signature">(query, options<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
Queries the collection based on the query object passed.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last">The query key/values that a document must match in
order for it to be returned in the result array.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>