UNPKG

forerunnerdb

Version:

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

3,734 lines (926 loc) 92.1 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#line16">line 16</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <ul><li><a href="#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></a></li><li><a href="#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></a></li><li><a href="#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></a></li><li><a href="#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></a></li><li><a href="#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></a></li><li><a href="#collection"><span class="type-signature">(static) </span>collection<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Collection.html">Collection</a>}</span></a></li><li><a href="#collectionGroup"><span class="type-signature">(static) </span>collectionGroup<span class="signature">(name)</span><span class="type-signature"> &rarr; {*}</span></a></li><li><a href="#document"><span class="type-signature">(static) </span>document<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Document.html">Document</a>}</span></a></li><li><a href="#document"><span class="type-signature">(static) </span>document<span class="signature">(data)</span><span class="type-signature"> &rarr; {<a href="Document.html">Document</a>}</span></a></li><li><a href="#document"><span class="type-signature">(static) </span>document<span class="signature">(documentName)</span><span class="type-signature"> &rarr; {<a href="Document.html">Document</a>}</span></a></li><li><a href="#document"><span class="type-signature">(static) </span>document<span class="signature">(documentName, options)</span><span class="type-signature"> &rarr; {<a href="Document.html">Document</a>}</span></a></li><li><a href="#documents"><span class="type-signature">(static) </span>documents<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></a></li><li><a href="#drop"><span class="type-signature">(static) </span>drop<span class="signature">(callback)</span><span class="type-signature"></span></a></li><li><a href="#drop"><span class="type-signature">(static) </span>drop<span class="signature">()</span><span class="type-signature"></span></a></li><li><a href="#drop"><span class="type-signature">(static) </span>drop<span class="signature">(removePersist)</span><span class="type-signature"></span></a></li><li><a href="#drop"><span class="type-signature">(static) </span>drop<span class="signature">(removePersist, callback)</span><span class="type-signature"></span></a></li><li><a href="#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></a></li><li><a href="#gridExists"><span class="type-signature">(static) </span>gridExists<span class="signature">(selector)</span><span class="type-signature"> &rarr; {boolean}</span></a></li><li><a href="#grids"><span class="type-signature">(static) </span>grids<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></a></li><li><a href="#load"><span class="type-signature">(static) </span>load<span class="signature">(callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></a></li><li><a href="#load"><span class="type-signature">(static) </span>load<span class="signature">(myData, callback)</span><span class="type-signature"></span></a></li><li><a href="#moduleLoaded"><span class="type-signature">(static) </span>moduleLoaded<span class="signature">(moduleName)</span><span class="type-signature"> &rarr; {Boolean}</span></a></li><li><a href="#moduleLoaded"><span class="type-signature">(static) </span>moduleLoaded<span class="signature">(moduleName, callback)</span><span class="type-signature"></span></a></li><li><a href="#moduleLoaded"><span class="type-signature">(static) </span>moduleLoaded<span class="signature">(moduleName, success, failure)</span><span class="type-signature"></span></a></li><li><a href="#save"><span class="type-signature">(static) </span>save<span class="signature">(options, callback)</span><span class="type-signature"></span></a></li><li><a href="#save"><span class="type-signature">(static) </span>save<span class="signature">(callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></a></li><li><a href="#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></a></li><li><a href="#arrayToCollection"><span class="type-signature"></span>arrayToCollection<span class="signature">(arr)</span><span class="type-signature"> &rarr; {<a href="Collection.html">Collection</a>}</span></a></li><li><a href="#collectionExists"><span class="type-signature"></span>collectionExists<span class="signature">(viewName)</span><span class="type-signature"> &rarr; {boolean}</span></a></li><li><a href="#collectionGroups"><span class="type-signature"></span>collectionGroups<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></a></li><li><a href="#collections"><span class="type-signature"></span>collections<span class="signature">(search)</span><span class="type-signature"> &rarr; {Array}</span></a></li><li><a href="#isClient"><span class="type-signature"></span>isClient<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></a></li><li><a href="#isClient"><span class="type-signature"></span>isClient<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></a></li><li><a href="#isServer"><span class="type-signature"></span>isServer<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></a></li><li><a href="#isServer"><span class="type-signature"></span>isServer<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></a></li><li><a href="#load"><span class="type-signature"></span>load<span class="signature">(callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></a></li><li><a href="#oldView"><span class="type-signature"></span>oldView<span class="signature">(viewName)</span><span class="type-signature"> &rarr; {*}</span></a></li><li><a href="#oldViewExists"><span class="type-signature"></span>oldViewExists<span class="signature">(viewName)</span><span class="type-signature"> &rarr; {boolean}</span></a></li><li><a href="#oldViews"><span class="type-signature"></span>oldViews<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></a></li><li><a href="#overview"><span class="type-signature"></span>overview<span class="signature">(name)</span><span class="type-signature"> &rarr; {*}</span></a></li><li><a href="#overviews"><span class="type-signature"></span>overviews<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></a></li><li><a href="#peek"><span class="type-signature"></span>peek<span class="signature">(search)</span><span class="type-signature"> &rarr; {Array}</span></a></li><li><a href="#peek"><span class="type-signature"></span>peek<span class="signature">(event, data<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></a></li><li><a href="#peekCat"><span class="type-signature"></span>peekCat<span class="signature">(search)</span><span class="type-signature"> &rarr; {Object}</span></a></li><li><a href="#persistedSize"><span class="type-signature"></span>persistedSize<span class="signature">(callback)</span><span class="type-signature"></span></a></li><li><a href="#procedure"><span class="type-signature"></span>procedure<span class="signature">(name, method<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></a></li><li><a href="#save"><span class="type-signature"></span>save<span class="signature">(callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></a></li><li><a href="#sectionEnter"><span class="type-signature"></span>sectionEnter<span class="signature">()</span><span class="type-signature"></span></a></li><li><a href="#sectionLeave"><span class="type-signature"></span>sectionLeave<span class="signature">()</span><span class="type-signature"></span></a></li><li><a href="#version"><span class="type-signature"></span>version<span class="signature">(val, callback)</span><span class="type-signature"> &rarr; {Boolean}</span></a></li><li><a href="#view"><span class="type-signature"></span>view<span class="signature">(name)</span><span class="type-signature"> &rarr; {*}</span></a></li><li><a href="#viewExists"><span class="type-signature"></span>viewExists<span class="signature">(name)</span><span class="type-signature"> &rarr; {boolean}</span></a></li><li><a href="#views"><span class="type-signature"></span>views<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></a></li></ul> <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#line3817">line 3817</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, 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#line3853">line 3853</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#line3776">line 3776</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#line3836">line 3836</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#line3801">line 3801</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">()</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> <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#line3760">line 3760</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=".collectionGroup"><span class="type-signature">(static) </span>collectionGroup<span class="signature">(name)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Creates a new collectionGroup instance or returns an existing instance if one already exists with the passed 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>name</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the instance.</td> </tr> </tbody> </table> <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#line307">line 307</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">()</span><span class="type-signature"> &rarr; {<a href="Document.html">Document</a>}</span></h4> <div class="description"> Get a document with no name (generates a random name). If the document does not already exist then one is created for that name automatically. </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#line481">line 481</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Document.html">Document</a></span> </dd> </dl> <h4 class="name" id=".document"><span class="type-signature">(static) </span>document<span class="signature">(data)</span><span class="type-signature"> &rarr; {<a href="Document.html">Document</a>}</span></h4> <div class="description"> Get a document by name. If the document 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 document instance.</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#line497">line 497</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Document.html">Document</a></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; {<a href="Document.html">Document</a>}</span></h4> <div class="description"> Get a document by name. If the document 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>documentName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the document.</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#line522">line 522</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Document.html">Document</a></span> </dd> </dl> <h4 class="name" id=".document"><span class="type-signature">(static) </span>document<span class="signature">(documentName, options)</span><span class="type-signature"> &rarr; {<a href="Document.html">Document</a>}</span></h4> <div class="description"> Get a document by name. If the document 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>documentName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The name of the document.</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="Document.js.html">Document.js</a>, <a href="Document.js.html#line538">line 538</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Document.html">Document</a></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#line598">line 598</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">(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">function</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#line403">line 403</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#line376">line 376</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#line440">line 440</a> </li></ul></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">function</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#line469">line 469</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#line695">line 695</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; {boolean}</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#line684">line 684</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=".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#line735">line 735</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=".load"><span class="type-signature">(static) </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">function</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#line947">line 947</a> </li></ul></dd> </dl> <h4 class="name" id=".load"><span class="type-signature">(static) </span>load<span class="signature">(myData, callback)</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 class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>myData</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Custom data to load into the collection.</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </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#line958">line 958</a> </li></ul></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#line31">line 31</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, 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">function</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#line57">line 57</a> </li></ul></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">function</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">function</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#line82">line 82</a> </li></ul></dd> </dl> <h4 class="name" id=".save"><span class="type-signature">(static) </span>save<span class="signature">(options, callback)</span><span class="type-signature"></span></h4> <div class="description"> Saves an entire database's data to persistent storage. </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>