UNPKG

mongo-portable

Version:

Portable Pure JS MongoDB - Based on Monglodb (https://github.com/euforic/monglodb.git) by Christian Sullivan (http://RogueSynaptics.com)

925 lines 69.1 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>MongoPortable | Mongo Portable</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../assets/css/main.css"> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="../index.html" class="title">Mongo Portable</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> <input type="checkbox" id="tsd-filter-only-exported" /> <label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <ul class="tsd-breadcrumb"> <li> <a href="../globals.html">Globals</a> </li> <li> <a href="mongoportable.html">MongoPortable</a> </li> </ul> <h1>Class MongoPortable</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <section class="tsd-panel tsd-comment"> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>MongoPortable</p> </div> <dl class="tsd-comment-tags"> <dt>module</dt> <dd><p>MongoPortable</p> </dd> <dt>since</dt> <dd><p>0.0.1</p> </dd> <dt>classdesc</dt> <dd><p>Portable database with persistence and MongoDB-like API</p> </dd> <dt>param</dt> <dd><p>Name of the database.</p> </dd> </dl> </div> </section> <section class="tsd-panel tsd-hierarchy"> <h3>Hierarchy</h3> <ul class="tsd-hierarchy"> <li> <a href="eventemitter.html" class="tsd-signature-type">EventEmitter</a> <ul class="tsd-hierarchy"> <li> <span class="target">MongoPortable</span> </li> </ul> </li> </ul> </section> <section class="tsd-panel-group tsd-index-group"> <h2>Index</h2> <section class="tsd-panel tsd-index-panel"> <div class="tsd-index-content"> <section class="tsd-index-section "> <h3>Constructors</h3> <ul class="tsd-index-list"> <li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a href="mongoportable.html#constructor" class="tsd-kind-icon">constructor</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Properties</h3> <ul class="tsd-index-list"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><a href="mongoportable.html#_collections" class="tsd-kind-icon">_collections</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><a href="mongoportable.html#_databasename" class="tsd-kind-icon">_database<wbr>Name</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><a href="mongoportable.html#_stores" class="tsd-kind-icon">_stores</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-overwrite tsd-is-protected"><a href="mongoportable.html#logger" class="tsd-kind-icon">logger</a></li> <li class="tsd-kind-property tsd-parent-kind-class"><a href="mongoportable.html#pkfactory" class="tsd-kind-icon">pk<wbr>Factory</a></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-private tsd-is-static"><a href="mongoportable.html#_connhelper" class="tsd-kind-icon">_conn<wbr>Helper</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Methods</h3> <ul class="tsd-index-list"> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#addstore" class="tsd-kind-icon">add<wbr>Store</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><a href="mongoportable.html#addstorefromfunction" class="tsd-kind-icon">add<wbr>Store<wbr>From<wbr>Function</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><a href="mongoportable.html#addstorefromobject" class="tsd-kind-icon">add<wbr>Store<wbr>From<wbr>Object</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#collection" class="tsd-kind-icon">collection</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#collectionnames" class="tsd-kind-icon">collection<wbr>Names</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#collections" class="tsd-kind-icon">collections</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#collectionsinfo" class="tsd-kind-icon">collections<wbr>Info</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#createcollection" class="tsd-kind-icon">create<wbr>Collection</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#createindex" class="tsd-kind-icon">create<wbr>Index</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#dereference" class="tsd-kind-icon">dereference</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#dropcollection" class="tsd-kind-icon">drop<wbr>Collection</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#dropdatabase" class="tsd-kind-icon">drop<wbr>Database</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#dropindex" class="tsd-kind-icon">drop<wbr>Index</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><a href="mongoportable.html#emit" class="tsd-kind-icon">emit</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#ensureindex" class="tsd-kind-icon">ensure<wbr>Index</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#fetchcollections" class="tsd-kind-icon">fetch<wbr>Collections</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#indexinformation" class="tsd-kind-icon">index<wbr>Information</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#reindex" class="tsd-kind-icon">re<wbr>Index</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#renamecollection" class="tsd-kind-icon">rename<wbr>Collection</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="mongoportable.html#use" class="tsd-kind-icon">use</a></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="mongoportable.html#getinstance" class="tsd-kind-icon">get<wbr>Instance</a></li> </ul> </section> <section class="tsd-index-section tsd-is-inherited"> <h3>Object literals</h3> <ul class="tsd-index-list"> <li class="tsd-kind-object-literal tsd-parent-kind-class tsd-is-inherited"><a href="mongoportable.html#options" class="tsd-kind-icon">options</a></li> </ul> </section> </div> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Constructors</h2> <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"> <a name="constructor" class="tsd-anchor"></a> <h3>constructor</h3> <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"> <li class="tsd-signature tsd-kind-icon">new <wbr>Mongo<wbr>Portable<span class="tsd-signature-symbol">(</span>databaseName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="mongoportable.html" class="tsd-signature-type">MongoPortable</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Overrides <a href="eventemitter.html">EventEmitter</a>.<a href="eventemitter.html#constructor">constructor</a></p> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L40">core/MongoPortable.ts:40</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>databaseName: <span class="tsd-signature-type">string</span></h5> </li> <li> <h5>options: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="mongoportable.html" class="tsd-signature-type">MongoPortable</a></h4> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Properties</h2> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-private"> <a name="_collections" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagPrivate">Private</span> _collections</h3> <div class="tsd-signature tsd-kind-icon">_collections<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">__type</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L38">core/MongoPortable.ts:38</a></li> </ul> </aside> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-private"> <a name="_databasename" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagPrivate">Private</span> _database<wbr>Name</h3> <div class="tsd-signature tsd-kind-icon">_database<wbr>Name<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L40">core/MongoPortable.ts:40</a></li> </ul> </aside> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-private"> <a name="_stores" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagPrivate">Private</span> _stores</h3> <div class="tsd-signature tsd-kind-icon">_stores<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">&gt;</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L39">core/MongoPortable.ts:39</a></li> </ul> </aside> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-overwrite tsd-is-protected"> <a name="logger" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagProtected">Protected</span> logger</h3> <div class="tsd-signature tsd-kind-icon">logger<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">JSWLogger</span></div> <aside class="tsd-sources"> <p>Overrides <a href="eventemitter.html">EventEmitter</a>.<a href="eventemitter.html#logger">logger</a></p> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L36">core/MongoPortable.ts:36</a></li> </ul> </aside> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"> <a name="pkfactory" class="tsd-anchor"></a> <h3>pk<wbr>Factory</h3> <div class="tsd-signature tsd-kind-icon">pk<wbr>Factory<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L34">core/MongoPortable.ts:34</a></li> </ul> </aside> </section> <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-private tsd-is-static"> <a name="_connhelper" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagStatic">Static</span> <span class="tsd-flag ts-flagPrivate">Private</span> _conn<wbr>Helper</h3> <div class="tsd-signature tsd-kind-icon">_conn<wbr>Helper<span class="tsd-signature-symbol">:</span> <a href="connectionhelper.html" class="tsd-signature-type">ConnectionHelper</a><span class="tsd-signature-symbol"> =&nbsp;new ConnectionHelper()</span></div> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L31">core/MongoPortable.ts:31</a></li> </ul> </aside> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Methods</h2> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="addstore" class="tsd-anchor"></a> <h3>add<wbr>Store</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">add<wbr>Store<span class="tsd-signature-symbol">(</span>store<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L91">core/MongoPortable.ts:91</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Adds a custom stores for remote and local persistence</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>store: <span class="tsd-signature-type">any</span></h5> <div class="tsd-comment tsd-typography"> <p>The custom store</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4> <p>this - The current Instance</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private"> <a name="addstorefromfunction" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagPrivate">Private</span> add<wbr>Store<wbr>From<wbr>Function</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private"> <li class="tsd-signature tsd-kind-icon">add<wbr>Store<wbr>From<wbr>Function<span class="tsd-signature-symbol">(</span>storeClass<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L106">core/MongoPortable.ts:106</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>storeClass: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private"> <a name="addstorefromobject" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagPrivate">Private</span> add<wbr>Store<wbr>From<wbr>Object</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private"> <li class="tsd-signature tsd-kind-icon">add<wbr>Store<wbr>From<wbr>Object<span class="tsd-signature-symbol">(</span>store<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L112">core/MongoPortable.ts:112</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>store: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="collection" class="tsd-anchor"></a> <h3>collection</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">collection<span class="tsd-signature-symbol">(</span>collectionName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="collection.html" class="tsd-signature-type">Collection</a><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L254">core/MongoPortable.ts:254</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Creates a collection on a server pre-allocating space, need to create f.ex capped collections.</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#collection</p> </dd> <dt>fires</dt> <dd><p>{@link MongoStore#createCollection}</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>collectionName: <span class="tsd-signature-type">any</span></h5> <div class="tsd-comment tsd-typography"> <p>the collection name we wish to access.</p> </div> </li> <li> <h5>options: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="collection.html" class="tsd-signature-type">Collection</a><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="collectionnames" class="tsd-anchor"></a> <h3>collection<wbr>Names</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">collection<wbr>Names<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L205">core/MongoPortable.ts:205</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the list of all collection names for the specified db, by calling MongoPortable#collections with [options.namesOnly = true]</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#collectionNames</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>options: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h4> <p>{@link MongoPortable#collections}</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="collections" class="tsd-anchor"></a> <h3>collections</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">collections<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L155">core/MongoPortable.ts:155</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Get the list of all collection for the specified db</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#collections</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>options: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="collectionsinfo" class="tsd-anchor"></a> <h3>collections<wbr>Info</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">collections<wbr>Info<span class="tsd-signature-symbol">(</span>collectionName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L128">core/MongoPortable.ts:128</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Returns a cursor to all the collection information.</p> </div> <dl class="tsd-comment-tags"> <dt>todo</dt> <dd><p>Implement</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>collectionName: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="createcollection" class="tsd-anchor"></a> <h3>create<wbr>Collection</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">create<wbr>Collection<span class="tsd-signature-symbol">(</span>collectionName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="collection.html" class="tsd-signature-type">Collection</a><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L312">core/MongoPortable.ts:312</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Alias for {@link MongoPortable#collection}</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#createCollection</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>collectionName: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5>options: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="collection.html" class="tsd-signature-type">Collection</a><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="createindex" class="tsd-anchor"></a> <h3>create<wbr>Index</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">create<wbr>Index<span class="tsd-signature-symbol">(</span>collectionName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, fieldOrSpec<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L452">core/MongoPortable.ts:452</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Creates an index on the collection.</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#createIndex</p> </dd> <dt>todo</dt> <dd><p>Implement</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>collectionName: <span class="tsd-signature-type">any</span></h5> <div class="tsd-comment tsd-typography"> <p>Name of the collection to create the index on.</p> </div> </li> <li> <h5>fieldOrSpec: <span class="tsd-signature-type">any</span></h5> <div class="tsd-comment tsd-typography"> <p>FieldOrSpec that defines the index.</p> </div> </li> <li> <h5>options: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5>callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="dereference" class="tsd-anchor"></a> <h3>dereference</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">dereference<span class="tsd-signature-symbol">(</span>dbRef<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L586">core/MongoPortable.ts:586</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Dereference a dbref, against a db</p> </div> <dl class="tsd-comment-tags"> <dt>todo</dt> <dd><p>Implement</p> </dd> <dt>ignore</dt> <dd></dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>dbRef: <span class="tsd-signature-type">any</span></h5> <div class="tsd-comment tsd-typography"> <p>db reference object we wish to resolve.</p> </div> </li> <li> <h5>callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="dropcollection" class="tsd-anchor"></a> <h3>drop<wbr>Collection</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">drop<wbr>Collection<span class="tsd-signature-symbol">(</span>collectionName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L326">core/MongoPortable.ts:326</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Drop a collection from the database, removing it permanently. New accesses will create a new collection.</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#dropCollection</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>collectionName: <span class="tsd-signature-type">any</span></h5> <div class="tsd-comment tsd-typography"> <p>The name of the collection we wish to drop.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Promise with &quot;true&quot; if dropped successfully</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="dropdatabase" class="tsd-anchor"></a> <h3>drop<wbr>Database</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">drop<wbr>Database<span class="tsd-signature-symbol">(</span>callback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L549">core/MongoPortable.ts:549</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Drop the whole database.</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#dropDatabase</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span></h4> <p>Promise with &quot;true&quot; if dropped successfully</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="dropindex" class="tsd-anchor"></a> <h3>drop<wbr>Index</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">drop<wbr>Index<span class="tsd-signature-symbol">(</span>collectionName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, indexName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L502">core/MongoPortable.ts:502</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Drop an index on a collection.</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#dropIndex</p> </dd> <dt>todo</dt> <dd><p>Implement</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>collectionName: <span class="tsd-signature-type">any</span></h5> <div class="tsd-comment tsd-typography"> <p>The name of the collection where the command will drop an index.</p> </div> </li> <li> <h5>indexName: <span class="tsd-signature-type">any</span></h5> <div class="tsd-comment tsd-typography"> <p>Name of the index to drop.</p> </div> </li> <li> <h5>callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"> <a name="emit" class="tsd-anchor"></a> <h3>emit</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"> <li class="tsd-signature tsd-kind-icon">emit<span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <p>Overrides <a href="eventemitter.html">EventEmitter</a>.<a href="eventemitter.html#emit">emit</a></p> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L63">core/MongoPortable.ts:63</a></li> </ul> </aside> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>name: <span class="tsd-signature-type">string</span></h5> </li> <li> <h5>args: <span class="tsd-signature-type">object</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="ensureindex" class="tsd-anchor"></a> <h3>ensure<wbr>Index</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">ensure<wbr>Index<span class="tsd-signature-symbol">(</span>collectionName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, fieldOrSpec<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L487">core/MongoPortable.ts:487</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Ensures that an index exists, if it does not it creates it</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#ensureIndex</p> </dd> <dt>todo</dt> <dd><p>Implement</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>collectionName: <span class="tsd-signature-type">any</span></h5> <div class="tsd-comment tsd-typography"> <p>Name of the collection to create the index on.</p> </div> </li> <li> <h5>fieldOrSpec: <span class="tsd-signature-type">any</span></h5> <div class="tsd-comment tsd-typography"> <p>FieldOrSpec that defines the index.</p> </div> </li> <li> <h5>options: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5>callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="fetchcollections" class="tsd-anchor"></a> <h3>fetch<wbr>Collections</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">fetch<wbr>Collections<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L137">core/MongoPortable.ts:137</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Alias for {@link MongoPortable#collections}</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#fetchCollections</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>options: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="indexinformation" class="tsd-anchor"></a> <h3>index<wbr>Information</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">index<wbr>Information<span class="tsd-signature-symbol">(</span>collectionName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L536">core/MongoPortable.ts:536</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Retrieves this collections index info.</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#indexInformation</p> </dd> <dt>todo</dt> <dd><p>Implement</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>collectionName: <span class="tsd-signature-type">any</span></h5> <div class="tsd-comment tsd-typography"> <p>The name of the collection.</p> </div> </li> <li> <h5>options: <span class="tsd-signature-type">any</span></h5> </li> <li> <h5>callback: <span class="tsd-signature-type">any</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="reindex" class="tsd-anchor"></a> <h3>re<wbr>Index</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">re<wbr>Index<span class="tsd-signature-symbol">(</span>collectionName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, callback<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in <a href="https://github.com/EastolfiWebDev/MongoPortable/blob/b25b7c9/src/core/MongoPortable.ts#L517">core/MongoPortable.ts:517</a></li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Reindex all indexes on the collection Warning: &quot;reIndex&quot; is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.</p> </div> <dl class="tsd-comment-tags"> <dt>method</dt> <dd><p>MongoPortable#reIndex</p> </dd> <dt>todo</dt> <dd><p>Implement</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</