Recommend this page to a friend! |
Classes of Xavier Pérez | XMongoDB | doc/5-other-operations.md | Download |
|
DownloadOther OperationsGet last inserted ID
Add values to an existing set
References: http://docs.mongodb.org/manual/reference/operator/update/addToSet/ Increment the value of a fieldIncrement only one field
Increment multiple fields
References: http://docs.mongodb.org/manual/reference/operator/update/dec/ Decrement the value of a fieldDecrement only one field
Decrement multiple fields
Now, MongoDB uses $inc function, you must to specify positive values in the $xmongodb->dec, this function converts to negative. References: http://docs.mongodb.org/manual/reference/operator/update/inc/ Pop an element of an arrayRemoves the first element in an array
Removes the first element in all elements specified
References: http://docs.mongodb.org/manual/reference/operator/update/pop/ Pull an element of an arrayRemoves the element of an array that match the value
References: http://docs.mongodb.org/manual/reference/operator/update/pull/ PullAll elements of an arrayThe pullAll operator removes all instances of the specified values from an existing array. Unlike the pull operator that removes elements by specifying a query, pullAll removes elements that match the listed values.
References: http://docs.mongodb.org/manual/reference/operator/update/pullAll/ AggregationsAggregations must to be done in array groups, one for each group (sort, project, group)
This will find a number of persons found by country, showing the first and the last name. |