DATAMONGO-832 - Polishing
Moved newly introduced types into order. Added missing @since tag and additional test. Updated reference documentation for update operators and added $slice operator to "what’s new" section. Original Pull Request: #374
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
[[new-features.1-10-0]]
|
||||
== What's new in Spring Data MongoDB 1.10
|
||||
* Support for `$min` and `$max` operators to `Update`.
|
||||
* Support for `$min`, `$max` and `$slice` operators via `Update`.
|
||||
|
||||
[[new-features.1-9-0]]
|
||||
== What's new in Spring Data MongoDB 1.9
|
||||
|
||||
@@ -879,6 +879,26 @@ Here is a listing of methods on the Update class
|
||||
* `Update` *setOnInsert* `(String key, Object value)` Update using the `$setOnInsert` update modifier
|
||||
* `Update` *unset* `(String key)` Update using the `$unset` update modifier
|
||||
|
||||
Some update modifiers like `$push` and `$addToSet` allow nesting of additional operators.
|
||||
|
||||
[source]
|
||||
----
|
||||
// { $push : { "category" : { "$each" : [ "spring" , "data" ] } } }
|
||||
new Update().push("category").each("spring", "data")
|
||||
|
||||
// { $push : { "key" : { "$position" : 0 , "$each" : [ "Arya" , "Arry" , "Weasel" ] } } }
|
||||
new Update().push("key").atPosition(Position.FIRST).each(Arrays.asList("Arya", "Arry", "Weasel"));
|
||||
|
||||
// { $push : { "key" : { "$slice" : 5 , "$each" : [ "Arya" , "Arry" , "Weasel" ] } } }
|
||||
new Update().push("key").slice(5).each(Arrays.asList("Arya", "Arry", "Weasel"));
|
||||
----
|
||||
|
||||
[source]
|
||||
----
|
||||
// { $addToSet : { "values" : { "$each" : [ "spring" , "data" , "mongodb" ] } } }
|
||||
new Update().addToSet("values").each("spring", "data", "mongodb");
|
||||
----
|
||||
|
||||
[[mongo-template.upserts]]
|
||||
=== Upserting documents in a collection
|
||||
|
||||
|
||||
Reference in New Issue
Block a user