Namespace: updateOperators

ink/probe. updateOperators

These operators manage updates (this is not a real namespace, but a document artifact to organize the symbols)

Source:

Members

<static> $dec

Decrements a field by the amount you specify. It takes the form { $dec: { field1: amount }

Source:
Example
          var probe = require("ink-probe");
          probe.update( obj, {'name.last' : 'Owen', 'name.first' : 'LeRoy'},
            {$dec : {'password.changes' : 2}} );

<static> $inc

Increments a field by the amount you specify. It takes the form { $inc: { field1: amount } }

Source:
Example
          var probe = require("ink-probe");
          probe.update( obj, {'name.last' : 'Owen', 'name.first' : 'LeRoy'},
            {$inc : {'password.changes' : 2}} );

<static> $pop

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: { $pop: { field: 1 } } or { $pop: { field: -1 } }

Source:
Example
          var probe = require("ink-probe");
          // attr is the name of the array field
          probe.update( data, {_id : '511d18827da2b88b09000133'}, {$pop : {attr : 1}} );

<static> $pull

The $pull operator removes all instances of a value from an existing array. It looks like this: { $pull: { field: <query> } }

Source:
Example
          var probe = require("ink-probe");
          // attr is the name of the array field
          probe.update( data, {'email' : 'EWallace.43@fauxprisons.com'},
            {$pull : {attr : {"color" : "green"}}} );

<static> $push

The $push operator appends a specified value to an array. It looks like this: { $push: { <field>: <value> } }

Source:
Example
          var probe = require("ink-probe");
          // attr is the name of the array field
          probe.update( data, {_id : '511d18827da2b88b09000133'},
              {$push : {attr : {"hand" : "new", "color" : "new"}}} );

<static> $unset

Removes the field from the object. It takes the form { $unset: { field1: "" } }

Source:
Example
          var probe = require("ink-probe");
          probe.update( data, {'name.first' : 'Yogi'}, {$unset : {'name.first' : ''}} );
ink-probe Copyright © 2012-2013 Terry Weiss. All rights reserved.
Documentation generated by JSDoc 3.2.0-dev on Sun Jun 09 2013 11:55:26 GMT-0400 (EDT) using the DocStrap template.