UNPKG

ink-docstrap

Version:

[![NPM](https://nodei.co/npm/ink-docstrap.png?downloads=true)](https://nodei.co/npm/ink-docstrap/)

834 lines (386 loc) 14.4 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>DocStrap Class: updateOperators</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> <link type="text/css" rel="stylesheet" href="styles/site.cerulean.css"> </head> <body> <div class="container-fluid"> <div class="navbar navbar-fixed-top navbar-inverse"> <div class="navbar-inner"> <a class="brand" href="index.html">DocStrap</a> <ul class="nav"> <li class="dropdown"> <a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a> <ul class="dropdown-menu "> <li> <a href="module-base.html">base</a> </li> <li> <a href="chains_.html">base/chains</a> </li> <li> <a href="binder.html">documents/binder</a> </li> <li> <a href="model_.html">documents/model</a> </li> <li> <a href="probe.html">documents/probe</a> </li> <li> <a href="schema_.html">documents/schema</a> </li> <li> <a href="collector.html">ink/collector</a> </li> <li> <a href="bussable_.html">mixins/bussable</a> </li> <li> <a href="signalable_.html">mixins/signalable</a> </li> <li> <a href="format.html">strings/format</a> </li> <li> <a href="logger.html">utils/logger</a> </li> </ul> </li> <li class="dropdown"> <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> <ul class="dropdown-menu "> <li> <a href="base.html">base</a> </li> <li> <a href="chains.html">base/chains</a> </li> <li> <a href="model.html">documents/model</a> </li> <li> <a href="probe.queryOperators.html">queryOperators</a> </li> <li> <a href="probe.updateOperators.html">updateOperators</a> </li> <li> <a href="collector-ACollector.html">ACollector</a> </li> <li> <a href="collector-CollectorBase_.html">CollectorBase</a> </li> <li> <a href="collector-OCollector.html">OCollector</a> </li> <li> <a href="signalable-Signal.html">Signal</a> </li> <li> <a href="logger.Logger.html">Logger</a> </li> </ul> </li> <li class="dropdown"> <a href="mixins.list.html" class="dropdown-toggle" data-toggle="dropdown">Mixins<b class="caret"></b></a> <ul class="dropdown-menu "> <li> <a href="schema.html">documents/schema</a> </li> <li> <a href="bussable.html">mixins/bussable</a> </li> <li> <a href="signalable.html">mixins/signalable</a> </li> </ul> </li> <li class="dropdown"> <a href="tutorials.list.html" class="dropdown-toggle" data-toggle="dropdown">Tutorials<b class="caret"></b></a> <ul class="dropdown-menu "> <li> <a href="tutorial-Teeth.html">Brush Teeth</a> </li> <li> <a href="tutorial-Car.html">Drive Car</a> </li> <li> <a href="tutorial-Test.html">Fence Test</a> </li> </ul> </li> <li class="dropdown"> <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a> <ul class="dropdown-menu "> <li> <a href="global.html#utils/logger">utils/logger</a> </li> </ul> </li> </ul> </div> </div> <div class="row-fluid"> <div class="span8"> <div id="main"> <h1 class="page-title">Class: updateOperators</h1> <section> <header> <h2> <span class="ancestors"><a href="probe.html">documents/probe</a>.</span> updateOperators </h2> <div class="class-description"><p>This is not actually a class, but an artifact of the documentation system</p></div> </header> <article> <div class="container-overview"> <dt> <h4 class="name" id="updateOperators"><span class="type-signature"></span>new updateOperators<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>These are the supported update operators</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="probe.js.html">documents/probe.js</a>, <a href="probe.js.html#sunlight-1-line-1007">line 1007</a> </li> </ul> </dd> </dl> </dd> </div> <h3 class="subsection-title">Members</h3> <dl> <dt> <h4 class="name" id="$dec"><span class="type-signature">&lt;static> </span>$dec<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Decrements a field by the amount you specify. It takes the form <code>{ $dec: { field1: amount }</code></p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="probe.js.html">documents/probe.js</a>, <a href="probe.js.html#sunlight-1-line-245">line 245</a> </li> </ul> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var probe = require(&quot;documents&#x2F;probe&quot;); probe.update( obj, {&#x27;name.last&#x27; : &#x27;Owen&#x27;, &#x27;name.first&#x27; : &#x27;LeRoy&#x27;}, {$dec : {&#x27;password.changes&#x27; : 2}} );</pre> </dd> <dt> <h4 class="name" id="$inc"><span class="type-signature">&lt;static> </span>$inc<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Increments a field by the amount you specify. It takes the form <code>{ $inc: { field1: amount } }</code></p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="probe.js.html">documents/probe.js</a>, <a href="probe.js.html#sunlight-1-line-225">line 225</a> </li> </ul> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var probe = require(&quot;documents&#x2F;probe&quot;); probe.update( obj, {&#x27;name.last&#x27; : &#x27;Owen&#x27;, &#x27;name.first&#x27; : &#x27;LeRoy&#x27;}, {$inc : {&#x27;password.changes&#x27; : 2}} );</pre> </dd> <dt> <h4 class="name" id="$pop"><span class="type-signature">&lt;static> </span>$pop<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>The $pop operator removes the first or last element of an array. Pass $pop a value of 1 to remove the last element in an array and a value of -1 to remove the first element of an array. This will only work on arrays. Syntax: <code>{ $pop: { field: 1 } }</code> or <code>{ $pop: { field: -1 } }</code></p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="probe.js.html">documents/probe.js</a>, <a href="probe.js.html#sunlight-1-line-277">line 277</a> </li> </ul> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var probe = require(&quot;documents&#x2F;probe&quot;); &#x2F;&#x2F; attr is the name of the array field probe.update( data, {_id : &#x27;511d18827da2b88b09000133&#x27;}, {$pop : {attr : 1}} );</pre> </dd> <dt> <h4 class="name" id="$pull"><span class="type-signature">&lt;static> </span>$pull<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>The $pull operator removes all instances of a value from an existing array. It looks like this: <code>{ $pull: { field: &lt;query&gt; } }</code></p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="probe.js.html">documents/probe.js</a>, <a href="probe.js.html#sunlight-1-line-318">line 318</a> </li> </ul> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var probe = require(&quot;documents&#x2F;probe&quot;); &#x2F;&#x2F; attr is the name of the array field probe.update( data, {&#x27;email&#x27; : &#x27;EWallace.43@fauxprisons.com&#x27;}, {$pull : {attr : {&quot;color&quot; : &quot;green&quot;}}} );</pre> </dd> <dt> <h4 class="name" id="$push"><span class="type-signature">&lt;static> </span>$push<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>The $push operator appends a specified value to an array. It looks like this: <code>{ $push: { &lt;field&gt;: &lt;value&gt; } }</code></p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="probe.js.html">documents/probe.js</a>, <a href="probe.js.html#sunlight-1-line-301">line 301</a> </li> </ul> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var probe = require(&quot;documents&#x2F;probe&quot;); &#x2F;&#x2F; attr is the name of the array field probe.update( data, {_id : &#x27;511d18827da2b88b09000133&#x27;}, {$push : {attr : {&quot;hand&quot; : &quot;new&quot;, &quot;color&quot; : &quot;new&quot;}}} );</pre> </dd> <dt> <h4 class="name" id="$unset"><span class="type-signature">&lt;static> </span>$unset<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Removes the field from the object. It takes the form <code>{ $unset: { field1: &quot;&quot; } }</code></p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="probe.js.html">documents/probe.js</a>, <a href="probe.js.html#sunlight-1-line-265">line 265</a> </li> </ul> </dd> </dl> <h5>Example</h5> <pre class="sunlight-highlight-javascript">var probe = require(&quot;documents&#x2F;probe&quot;); probe.update( data, {&#x27;name.first&#x27; : &#x27;Yogi&#x27;}, {$unset : {&#x27;name.first&#x27; : &#x27;&#x27;}} );</pre> </dd> </dl> </article> </section> </div> <div class="clearfix"></div> <footer> <span class="copyright"> DocStrap Copyright © 2012-2013 The contributors to the JSDoc3 and DocStrap projects. </span> <br /> <span class="jsdoc-message"> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Sun Jun 1st 2014 using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>. </span> </footer> </div> <div class="span3"> <div id="toc"></div> </div> <br clear="both"> </div> </div> <!--<script src="scripts/sunlight.js"></script>--> <script src="scripts/docstrap.lib.js"></script> <script src="scripts/bootstrap-dropdown.js"></script> <script src="scripts/toc.js"></script> <script> $( function () { $( "#toc" ).toc( { anchorName : function ( i, heading, prefix ) { return $( heading ).attr( "id" ) || ( prefix + i ); }, selectors : "h1,h2,h3,h4", showAndHide : false, scrollTo : 60 } ); $( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" ); $( "#main span[id^='toc']" ).addClass( "toc-shim" ); // $( ".tutorial-section pre, .readme-section pre" ).addClass( "sunlight-highlight-javascript" ).addClass( "linenums" ); $( ".tutorial-section pre, .readme-section pre" ).each( function () { var $this = $( this ); var example = $this.find("code" ); exampleText = example.html(); var lang = /{@lang (.*?)}/.exec( exampleText ); if ( lang && lang[1] ) { exampleText = exampleText.replace( lang[0], "" ); example.html(exampleText); lang = lang[1]; } else { lang = "javascript"; } if ( lang ) { $this .addClass( "sunlight-highlight-" + lang ) .addClass( "linenums" ) .html( example.html() ); } } ); Sunlight.highlightAll( { lineNumbers : true, showMenu:true, enableDoclinks:true } ); } ); </script> <!--Google Analytics--> <!--Navigation and Symbol Display--> </body> </html>