forerunnerdb
Version:
A NoSQL document store database for browsers and Node.js.
2,322 lines (586 loc) • 27.6 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: FdbDocument</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: FdbDocument</h1>
<section>
<header>
<h2>
FdbDocument
</h2>
<div class="class-description">Document</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="FdbDocument"><span class="type-signature"></span>new FdbDocument<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Creates a new Document instance. Documents allow you to create individual
objects that can have standard ForerunnerDB CRUD operations run against
them, as well as data-binding if the AutoBind module is included in your
project.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line17">line 17</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="updateObject"><span class="type-signature">(private) </span>updateObject<span class="type-signature"></span></h4>
<div class="description">
Internal method for document updating.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line159">line 159</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="_isPositionalKey"><span class="type-signature">(private) </span>_isPositionalKey<span class="signature">(key)</span><span class="type-signature"> → {Boolean}</span></h4>
<div class="description">
Determines if the passed key has an array positional mark (a dollar at the end
of its name).
</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>key</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The key to check.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line168">line 168</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if it is a positional or false if not.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="_updateIncrement"><span class="type-signature">(private) </span>_updateIncrement<span class="signature">(doc, prop, val)</span><span class="type-signature"></span></h4>
<div class="description">
Increments a value for a property on a document by the passed number.
</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>doc</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to modify.</td>
</tr>
<tr>
<td class="name"><code>prop</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The property to modify.</td>
</tr>
<tr>
<td class="name"><code>val</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The amount to increment by.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line203">line 203</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_updateMultiply"><span class="type-signature">(private) </span>_updateMultiply<span class="signature">(doc, prop, val)</span><span class="type-signature"></span></h4>
<div class="description">
Multiplies a value for a property on a document by the passed number.
</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>doc</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to modify.</td>
</tr>
<tr>
<td class="name"><code>prop</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The property to modify.</td>
</tr>
<tr>
<td class="name"><code>val</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The amount to multiply by.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line292">line 292</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_updatePop"><span class="type-signature">(private) </span>_updatePop<span class="signature">(doc, val)</span><span class="type-signature"> → {Boolean}</span></h4>
<div class="description">
Deletes a property on a document.
</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>doc</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to modify.</td>
</tr>
<tr>
<td class="name"><code>val</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">The property to delete.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line339">line 339</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="_updateProperty"><span class="type-signature">(private) </span>_updateProperty<span class="signature">(doc, prop, val)</span><span class="type-signature"></span></h4>
<div class="description">
Updates a property on an object depending on if the collection is
currently running data-binding or not.
</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>doc</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The object whose property is to be updated.</td>
</tr>
<tr>
<td class="name"><code>prop</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The property to update.</td>
</tr>
<tr>
<td class="name"><code>val</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">The new value of the property.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line180">line 180</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_updatePull"><span class="type-signature">(private) </span>_updatePull<span class="signature">(arr, index)</span><span class="type-signature"></span></h4>
<div class="description">
Removes an item from the passed array.
</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>arr</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">The array to modify.</td>
</tr>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The index of the item in the array to remove.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line277">line 277</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_updatePush"><span class="type-signature">(private) </span>_updatePush<span class="signature">(arr, doc)</span><span class="type-signature"></span></h4>
<div class="description">
Inserts an item at the end of an array.
</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>arr</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">The array to insert the item into.</td>
</tr>
<tr>
<td class="name"><code>doc</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to insert.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line263">line 263</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_updateRename"><span class="type-signature">(private) </span>_updateRename<span class="signature">(doc, prop, val)</span><span class="type-signature"></span></h4>
<div class="description">
Renames a property on a document to the passed property.
</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>doc</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to modify.</td>
</tr>
<tr>
<td class="name"><code>prop</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The property to rename.</td>
</tr>
<tr>
<td class="name"><code>val</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The new property name.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line307">line 307</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_updateSpliceMove"><span class="type-signature">(private) </span>_updateSpliceMove<span class="signature">(arr, indexFrom, indexTo)</span><span class="type-signature"></span></h4>
<div class="description">
Changes the index of an item in the passed array.
</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>arr</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">The array to modify.</td>
</tr>
<tr>
<td class="name"><code>indexFrom</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The index to move the item from.</td>
</tr>
<tr>
<td class="name"><code>indexTo</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The index to move the item to.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line218">line 218</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_updateSplicePush"><span class="type-signature">(private) </span>_updateSplicePush<span class="signature">(arr, index, doc)</span><span class="type-signature"></span></h4>
<div class="description">
Inserts an item into the passed array at the specified index.
</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>arr</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">The array to insert into.</td>
</tr>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The index to insert at.</td>
</tr>
<tr>
<td class="name"><code>doc</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to insert.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line241">line 241</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_updateUnset"><span class="type-signature">(private) </span>_updateUnset<span class="signature">(doc, prop)</span><span class="type-signature"></span></h4>
<div class="description">
Deletes a property on a document.
</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>doc</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document to modify.</td>
</tr>
<tr>
<td class="name"><code>prop</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The property to delete.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Document.js.html">Document.js</a>, <a href="Document.js.html#line324">line 324</a>
</li></ul></dd>
</dl>
<h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">(query, update, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
Modifies the document. This will update the document with the data held in 'update'.
</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 that must be matched for a document to be
operated on.</td>
</tr>
<tr>
<td class="name"><code>update</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last">The object containing updated key/values. Any keys that
match keys on the existing document will be overwritten with this data. Any
keys that do not currently exist on the document will be added to the document.</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">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="Document.js.html">Document.js</a>, <a href="Document.js.html#line142">line 142</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The items that were updated.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ActiveBucket.html">ActiveBucket</a></li><li><a href="AutoBind.html">AutoBind</a></li><li><a href="Collection.html">Collection</a></li><li><a href="CollectionGroup.html">CollectionGroup</a></li><li><a href="Core.html">Core</a></li><li><a href="Db.html">Db</a></li><li><a href="FdbDocument.html">FdbDocument</a></li><li><a href="Grid.html">Grid</a></li><li><a href="Highchart.html">Highchart</a></li><li><a href="IndexBinaryTree.html">IndexBinaryTree</a></li><li><a href="IndexHashMap.html">IndexHashMap</a></li><li><a href="KeyValueStore.html">KeyValueStore</a></li><li><a href="Metrics.html">Metrics</a></li><li><a href="OldView.html">OldView</a></li><li><a href="Operation.html">Operation</a></li><li><a href="Overload.html">Overload</a></li><li><a href="Path.html">Path</a></li><li><a href="Shared.overload.html">overload</a></li><li><a href="View.html">View</a></li></ul><h3>Mixins</h3><ul><li><a href="ChainReactor.html">ChainReactor</a></li><li><a href="crcTable.html">crcTable</a></li><li><a href="Shared.html">Shared</a></li></ul><h3>Global</h3><ul><li><a href="global.html#%2522boolean,function%2522">"boolean, function"</a></li><li><a href="global.html#%2522string,*,function%2522">"string, *, function"</a></li><li><a href="global.html#%2522string,function%2522">"string, function"</a></li><li><a href="global.html#boolean">boolean</a></li><li><a href="global.html#function">function</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.1</a> on Thu Jun 11 2015 10:51:16 GMT+0100 (BST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>