UNPKG

forerunnerdb

Version:

A NoSQL document store database for browsers and Node.js.

4,708 lines (1,167 loc) 72.7 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Db</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: Db</h1> <section> <header> <h2> Db </h2> </header> <article> <div class="container-overview"> <h4 class="name" id="Db"><span class="type-signature"></span>new Db<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Creates a new ForerunnerDB database instance. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line17">line 17</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Members</h3> <h4 class="name" id="crc"><span class="type-signature"></span>crc<span class="type-signature"></span></h4> <div class="description"> Returns a checksum of a string. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line207">line 207</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".collection"><span class="type-signature">(static) </span>collection<span class="signature">(collectionName, primaryKey, options)</span><span class="type-signature"> &rarr; {<a href="Collection.html">Collection</a>}</span></h4> <div class="description"> Get a collection by name. If the collection does not already exist then one is created for that name automatically. </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>collectionName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the collection.</td> </tr> <tr> <td class="name"><code>primaryKey</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Optional primary key to specify the primary key field on the collection objects. Defaults to "_id".</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#line3349">line 3349</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Collection.html">Collection</a></span> </dd> </dl> <h4 class="name" id=".collection"><span class="type-signature">(static) </span>collection<span class="signature">(collectionName, options)</span><span class="type-signature"> &rarr; {<a href="Collection.html">Collection</a>}</span></h4> <div class="description"> Get a collection by name. If the collection does not already exist then one is created for that name automatically. </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>collectionName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the collection.</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#line3334">line 3334</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Collection.html">Collection</a></span> </dd> </dl> <h4 class="name" id=".collection"><span class="type-signature">(static) </span>collection<span class="signature">(collectionName, primaryKey)</span><span class="type-signature"> &rarr; {<a href="Collection.html">Collection</a>}</span></h4> <div class="description"> Get a collection by name. If the collection does not already exist then one is created for that name automatically. </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>collectionName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the collection.</td> </tr> <tr> <td class="name"><code>primaryKey</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Optional primary key to specify the primary key field on the collection objects. Defaults to "_id".</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#line3317">line 3317</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Collection.html">Collection</a></span> </dd> </dl> <h4 class="name" id=".collection"><span class="type-signature">(static) </span>collection<span class="signature">(collectionName)</span><span class="type-signature"> &rarr; {<a href="Collection.html">Collection</a>}</span></h4> <div class="description"> Get a collection by name. If the collection does not already exist then one is created for that name automatically. </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>collectionName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the collection.</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#line3303">line 3303</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Collection.html">Collection</a></span> </dd> </dl> <h4 class="name" id=".collection"><span class="type-signature">(static) </span>collection<span class="signature">(data)</span><span class="type-signature"> &rarr; {<a href="Collection.html">Collection</a>}</span></h4> <div class="description"> Get a collection by name. If the collection does not already exist then one is created for that name automatically. </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>data</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">An options object or a collection instance.</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#line3280">line 3280</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Collection.html">Collection</a></span> </dd> </dl> <h4 class="name" id=".collection"><span class="type-signature">(static) </span>collection<span class="signature">(collectionName)</span><span class="type-signature"> &rarr; {<a href="Collection.html">Collection</a>}</span></h4> <div class="description"> Get a collection with no name (generates a random name). If the collection does not already exist then one is created for that name automatically. </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>collectionName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the collection.</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#line3265">line 3265</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Collection.html">Collection</a></span> </dd> </dl> <h4 class="name" id=".collection"><span class="type-signature">(static) </span>collection<span class="signature">(options)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> The main handler method. This gets called by all the other variants and handles the actual logic of the overloaded 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>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#line3367">line 3367</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id=".document"><span class="type-signature">(static) </span>document<span class="signature">(documentName)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Creates a new document instance. </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>documentName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the document to create.</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#line394">line 394</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id=".documents"><span class="type-signature">(static) </span>documents<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Returns an array of documents the DB currently has. </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#line421">line 421</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> An array of objects containing details of each document the database is currently managing. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id=".drop"><span class="type-signature">(static) </span>drop<span class="signature">(removePersist, callback)</span><span class="type-signature"></span></h4> <div class="description"> Drops the database and optionally controls dropping persistent storage and callback 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>removePersist</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">Drop persistent storage for this database.</td> </tr> <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="description last">Optional callback method.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line451">line 451</a> </li></ul></dd> </dl> <h4 class="name" id=".drop"><span class="type-signature">(static) </span>drop<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Drops the database. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line361">line 361</a> </li></ul></dd> </dl> <h4 class="name" id=".drop"><span class="type-signature">(static) </span>drop<span class="signature">(callback)</span><span class="type-signature"></span></h4> <div class="description"> Drops the database with optional callback 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>callback</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="description last">Optional callback method.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line387">line 387</a> </li></ul></dd> </dl> <h4 class="name" id=".drop"><span class="type-signature">(static) </span>drop<span class="signature">(removePersist)</span><span class="type-signature"></span></h4> <div class="description"> Drops the database with optional persistent storage drop. Persistent storage is dropped by default if no preference is provided. </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>removePersist</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">Drop persistent storage for this database.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line423">line 423</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"> &rarr; {*}</span></h4> <div class="description"> Creates a grid based on the passed arguments. </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">The jQuery selector of the grid to retrieve.</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"> &lt;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#line623">line 623</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id=".gridExists"><span class="type-signature">(static) </span>gridExists<span class="signature">(selector)</span><span class="type-signature"> &rarr; {<a href="global.html#boolean">boolean</a>}</span></h4> <div class="description"> Determine if a grid with the passed name already exists. </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 jQuery selector to bind the grid to.</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#line612">line 612</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="global.html#boolean">boolean</a></span> </dd> </dl> <h4 class="name" id=".grids"><span class="type-signature">(static) </span>grids<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Returns an array of grids the DB currently has. </div> <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#line663">line 663</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> An array of objects containing details of each grid the database is currently managing. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id=".moduleLoaded"><span class="type-signature">(static) </span>moduleLoaded<span class="signature">(moduleName)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Checks if a module has been loaded into the database. </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>moduleName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the module to check for.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line32">line 32</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> True if the module is loaded, false if not. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id=".moduleLoaded"><span class="type-signature">(static) </span>moduleLoaded<span class="signature">(moduleName, success, failure)</span><span class="type-signature"></span></h4> <div class="description"> Checks if a module is loaded and if so calls the passed success method, otherwise calls the failure 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>moduleName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the module to check for.</td> </tr> <tr> <td class="name"><code>success</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="description last">The callback method to call if module is loaded.</td> </tr> <tr> <td class="name"><code>failure</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="description last">The callback method to call if module not loaded.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line83">line 83</a> </li></ul></dd> </dl> <h4 class="name" id=".moduleLoaded"><span class="type-signature">(static) </span>moduleLoaded<span class="signature">(moduleName, callback)</span><span class="type-signature"></span></h4> <div class="description"> Checks if a module is loaded and if so calls the passed callback 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>moduleName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the module to check for.</td> </tr> <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="description last">The callback method to call if module is loaded.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line58">line 58</a> </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"> &rarr; {*}</span></h4> <div class="description"> Removes a grid based on the passed arguments. </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">The jQuery selector of the grid to retrieve.</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"> &lt;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#line643">line 643</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="arrayToCollection"><span class="type-signature"></span>arrayToCollection<span class="signature">(arr)</span><span class="type-signature"> &rarr; {<a href="Collection.html">Collection</a>}</span></h4> <div class="description"> Converts a normal javascript array of objects into a DB collection. </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">An array of objects.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line233">line 233</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> A new collection instance with the data set to the array passed. </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Collection.html">Collection</a></span> </dd> </dl> <h4 class="name" id="collectionExists"><span class="type-signature"></span>collectionExists<span class="signature">(viewName)</span><span class="type-signature"> &rarr; {<a href="global.html#boolean">boolean</a>}</span></h4> <div class="description"> Determine if a collection with the passed name already exists. </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>viewName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the collection to check for.</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#line3413">line 3413</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="global.html#boolean">boolean</a></span> </dd> </dl> <h4 class="name" id="collectionGroups"><span class="type-signature"></span>collectionGroups<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Returns an array of collection groups the DB currently has. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="CollectionGroup.js.html">CollectionGroup.js</a>, <a href="CollectionGroup.js.html#line321">line 321</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> An array of objects containing details of each collection group the database is currently managing. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id="collections"><span class="type-signature"></span>collections<span class="signature">(search)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Returns an array of collections the DB currently has. </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>search</code></td> <td class="type"> <span class="param-type">String</span> | <span class="param-type">RegExp</span> </td> <td class="description last">The optional search string or regular expression to use to match collection names 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#line3425">line 3425</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> An array of objects containing details of each collection the database is currently managing. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id="emit"><span class="type-signature"></span>emit<span class="signature">(event, data<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Emits an event by name with the given data. </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>event</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="description last">The name of the event to emit.</td> </tr> <tr> <td class="name"><code>data</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">The data to emit with the event.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line278">line 278</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="isClient"><span class="type-signature"></span>isClient<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="global.html#boolean">boolean</a>}</span></h4> <div class="description"> Returns true if ForerunnerDB is running on a client browser. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line190">line 190</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="global.html#boolean">boolean</a></span> </dd> </dl> <h4 class="name" id="isClient"><span class="type-signature"></span>isClient<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Checks if the database is running on a client (browser) or a server (node.js). </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line214">line 214</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Returns true if running on a browser. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id="isServer"><span class="type-signature"></span>isServer<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="global.html#boolean">boolean</a>}</span></h4> <div class="description"> Returns true if ForerunnerDB is running on a server. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line198">line 198</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="global.html#boolean">boolean</a></span> </dd> </dl> <h4 class="name" id="isServer"><span class="type-signature"></span>isServer<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Checks if the database is running on a client (browser) or a server (node.js). </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Db.js.html">Db.js</a>, <a href="Db.js.html#line223">line 223</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Returns true if running on a server. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id="load"><span class="type-signature"></span>load<span class="signature">(callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> Loads an entire database's data from persistent storage. </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"> &lt;optional><br> </td> <td class="description last">The method to call when the load function 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="Persist.js.html">Persist.js</a>, <a href="Persist.js.html#line556">line 556</a> </li></ul></dd> </dl> <h4 class="name" id="load"><span class="type-signature"></span>load<span class="signature">(callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> Loads an entire database's data from persistent storage. </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"> &lt;optional><br> </td> <td class="description last">The method to call when the load function has completed.</td> </tr> </tbody> </table> <dl class="details">