Adds elements to an array only if they do not already exist in the set.
Adds elements to an array only if they do not already exist in the set.
{ $addToSet: {letters: [ "c", "d" ] } }
The $all is equivalent to an $and operation of the specified values; i.e.
The $all is equivalent to an $and operation of the specified values; i.e. the following statement:
{ tags: { $all: [ "ssl" , "security" ] } }
The $all is equivalent to an $and operation of the specified values; i.e.
The $all is equivalent to an $and operation of the specified values; i.e. the following statement:
{ tags: { $all: [ "ssl" , "security" ] } }
Projects the first element in an array that matches the specified $elemMatch condition.
Projects the first element in an array that matches the specified $elemMatch condition.
{ students: { $elemMatch: { school: 102 } } }
Projects the first element in an array that matches the specified $elemMatch condition.
Projects the first element in an array that matches the specified $elemMatch condition.
{ students: { $elemMatch: { school: 102 } } }
Matches documents that have the specified field.
Matches documents that have the specified field.
db.inventory.find( { qty: { $exists: true, $nin: [ 5, 15 ] } } )
Matches values that are greater than a specified value.
Matches values that are greater than a specified value.
db.inventory.find( { qty: { $gt: 20 } } )
Matches values that are greater than or equal to a specified value.
Matches values that are greater than or equal to a specified value.
db.inventory.find( { qty: { $gte: 20 } } )
Matches any of the values specified in an array.
Matches any of the values specified in an array.
db.inventory.find( { qty: { $in: [ 5, 15 ] } } )
{ $inc: { <field1>: <amount1>, <field2>: <amount2>, ... } }
Matches values that are less than a specified value.
Matches values that are less than a specified value.
db.inventory.find( { qty: { $lt: 20 } } )
Matches values that are less than or equal to a specified value.
Matches values that are less than or equal to a specified value.
db.inventory.find( { qty: { $lte: 20 } } )
The $meta projection operator returns for each matching document the metadata (e.g.
The $meta projection operator returns for each matching document the metadata (e.g. "textScore") associated with the query.
db.collection.find({}, { score: { $meta: "textScore" } })
Performs a modulo operation on the value of a field and selects documents with a specified result.
Performs a modulo operation on the value of a field and selects documents with a specified result.
db.inventory.find( { qty: { $mod: [ 4, 0 ] } } )
Performs a modulo operation on the value of a field and selects documents with a specified result.
Performs a modulo operation on the value of a field and selects documents with a specified result.
db.inventory.find( { qty: { $mod: [ 4, 0 ] } } )
Matches all values that are not equal to a specified value.
Matches all values that are not equal to a specified value.
db.inventory.find( { qty: { $ne: 20 } } )
Matches none of the values specified in an array.
Matches none of the values specified in an array.
db.inventory.find( { qty: { $nin: [ 5, 15 ] } } )
Inverts the effect of a query expression and returns documents that do not match the query expression.
Inverts the effect of a query expression and returns documents that do not match the query expression.
db.inventory.find( { price: { $not: { $gt: 1.99 } } } )
The $orderby operator sorts the results of a query in ascending or descending order.
The $orderby operator sorts the results of a query in ascending or descending order.
db.collection.find( { $query: {}, $orderby: { age : -1 } } )
Removes the first or last item of an array.
Removes the first or last item of an array.
db.students.update( { _id: 1 }, { $pop: { scores: -1 } } )
The $pull operator removes from an existing array all instances of a value or values that match a specified condition.
The $pull operator removes from an existing array all instances of a value or values that match a specified condition.
{ $pull: { results: { $elemMatch: { score: 8 , item: "B" } } } }
The $pull operator removes from an existing array all instances of a value or values that match a specified condition.
The $pull operator removes from an existing array all instances of a value or values that match a specified condition.
{ $pull: { results: { $elemMatch: { score: 8 , item: "B" } } } }
The $pull operator removes from an existing array all instances of a value or values that match a specified condition.
The $pull operator removes from an existing array all instances of a value or values that match a specified condition.
db.survey.update( { _id: 1 }, { $pullAll: { scores: [ 0, 5 ] } } )
The $pull operator removes from an existing array all instances of a value or values that match a specified condition.
The $pull operator removes from an existing array all instances of a value or values that match a specified condition.
db.survey.update( { _id: 1 }, { $pullAll: { scores: [ 0, 5 ] } } )
Selects documents where values match a specified regular expression.
Selects documents where values match a specified regular expression.
db.products.find( { sku: { $regex: /^ABC/i } } )
{ $set: { <field1>: <value1>, <field2>: <value2>, ... } }
Selects documents if the array field is a specified size.
Selects documents if the array field is a specified size.
db.collection.find( { field: { $size: 1 } } )
The $slice operator controls the number of items of an array that a query returns.
The $slice operator controls the number of items of an array that a query returns. For information on limiting the size of an array during an update with $push, see the $slice modifier instead.
db.posts.find( {}, { comments: { $slice: 5 } } )
count: { $sum: 1 }
Selects documents if a field is of the specified type.
Selects documents if a field is of the specified type.
db.data.find( { x: { $type: "minKey" } } )
Specifies equality condition.
Specifies equality condition. The $eq operator matches documents where the value of a field equals the specified value.
db.inventory.find( { qty: 20 } )
db.inventory.find( { qty: { $eq: 20 } } )
the given JSON attribute
Mongo DSL Extensions