new queryOperators()

Descripción

This is not actually a class, but an artifact of the documentation system

Detalles

Miembros


<static> $eq

Descripción

$eq performs a === comparison by comparing the value directly if it is an atomic value.
otherwise if it is an array, it checks to see if the value looked for is in the array.
{field: value} or {field: {$eq : value}} or {array: value} or {array: {$eq : value}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {categories : "cat1"} );
// is the same as
probe.find( data, {categories : {$eq: "cat1"}} );
Detalles

<static> $ne

Descripción

$ne performs a !== comparison by comparing the value directly if it is an atomic value. Otherwise, if it is an array
this is performs a "not in array".
'{field: {$ne : value}}or '{array: {$ne : value}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {"name.first" : {$ne : "Sheryl"}} );
Detalles

<static> $all

Descripción

$all checks to see if all of the members of the query are included in an array
{array: {$all: [val1, val2, val3]}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {"categories" : {$all : ["cat4", "cat2", "cat1"]}} );
Detalles

<static> $gt

Descripción

$gt Sees if a field is greater than the value
{field: {$gt: value}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {"age" : {$gt : 24}} );
Detalles

<static> $gte

Descripción

$gte Sees if a field is greater than or equal to the value
{field: {$gte: value}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {"age" : {$gte : 50}} );
Detalles

<static> $lt

Descripción

$lt Sees if a field is less than the value
{field: {$lt: value}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {"age" : {$lt : 24}} );
Detalles

<static> $lte

Descripción

$lte Sees if a field is less than or equal to the value
{field: {$lte: value}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {"age" : {$lte : 50}} );
Detalles

<static> $in

Descripción

$in Sees if a field has one of the values in the query
{field: {$in: [test1, test2, test3,...]}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {"age" : {$in : [24, 28, 60]}} );
Detalles

<static> $nin

Descripción

$nin Sees if a field has none of the values in the query
{field: {$nin: [test1, test2, test3,...]}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {"age" : {$nin : [24, 28, 60]}} );
Detalles

<static> $exists

Descripción

$exists Sees if a field exists.
{field: {$exists: true|false}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {"name.middle" : {$exists : true}} );
Detalles

<static> $mod

Descripción

Checks equality to a modulus operation on a field
{field: {$mod: [divisor, remainder]}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {"age" : {$mod : [2, 0]}} );
Detalles

<static> $size

Descripción

Compares the size of the field/array to the query. This can be used on arrays, strings and objects (where it will count keys)
{'field|array: {$size: value}}`

Ejemplos
var probe = require("documents/probe");
probe.find( data, {attr : {$size : 3}} );
Detalles

<static> $regex

Descripción

Performs a regular expression test againts the field
{field: {$regex: re, $options: reOptions}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {"name.first" : {$regex : "m*", $options : "i"}} );
Detalles

<static> $elemMatch

Descripción

This is like $all except that it works with an array of objects or value. It checks to see the array matches all
of the conditions of the query
{array: {$elemMatch: {path: value, path: {$operation: value2}}}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {attr : {$elemMatch : [
 {color : "red", "hand" : "left"}
]}} );
Detalles

<static> $and

Descripción

Returns true if all of the conditions of the query are met
{$and: [query1, query2, query3]}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {$and : [
     {"name.first" : "Mildred"},
     {"name.last" : "Graves"}
]} );
Detalles

<static> $or

Descripción

Returns true if any of the conditions of the query are met
{$or: [query1, query2, query3]}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {$or : [
     "age" : {$in : [24, 28, 60]}},
     {categories : "cat1"}
]} );
Detalles

<static> $nor

Descripción

Returns true if none of the conditions of the query are met
{$nor: [query1, query2, query3]}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {$nor : [
     {"age" : {$in : [24, 28, 60]}},
     {categories : "cat1"}
]} );
Detalles

<static> $not

Descripción

Logical NOT on the conditions of the query
{$not: [query1, query2, query3]}

Ejemplos
var probe = require("documents/probe");
probe.find( data, {$not : {"age" : {$lt : 24}}} );
Detalles