Package com.mongodb.client.model
Class PushOptions
- java.lang.Object
-
- com.mongodb.client.model.PushOptions
-
public class PushOptions extends Object
The options to apply to a $push update operator.- Since:
- 3.1
- See Also:
Updates.pushEach(String, java.util.List, PushOptions)- MongoDB documentation
- $push
-
-
Constructor Summary
Constructors Constructor Description PushOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)IntegergetPosition()Gets the position at which to add the pushed values in the array.IntegergetSlice()Gets the slice value, which is the limit on the number of array elements allowed.IntegergetSort()Gets the sort direction for sorting array elements that are not documents.BsongetSortDocument()Gets the sort direction for sorting array elements that are documents.inthashCode()PushOptionsposition(Integer position)Sets the position at which to add the pushed values in the array.PushOptionsslice(Integer slice)Sets the limit on the number of array elements allowed.PushOptionssort(Integer sort)Sets the sort direction for sorting array elements that are not documents.PushOptionssortDocument(Bson sortDocument)Sets the sort direction for sorting array elements that are documents.StringtoString()
-
-
-
Method Detail
-
getPosition
@Nullable public Integer getPosition()
Gets the position at which to add the pushed values in the array.- Returns:
- the position, which may be null
- MongoDB documentation
- $position
-
position
public PushOptions position(@Nullable Integer position)
Sets the position at which to add the pushed values in the array.- Parameters:
position- the position- Returns:
- this
- MongoDB documentation
- $position
-
getSlice
@Nullable public Integer getSlice()
Gets the slice value, which is the limit on the number of array elements allowed.- Returns:
- the slice value representing the limit on the number of array elements allowed
- MongoDB documentation
- $slice
-
slice
public PushOptions slice(@Nullable Integer slice)
Sets the limit on the number of array elements allowed.- Parameters:
slice- the limit- Returns:
- this
- MongoDB documentation
- $slice
-
getSort
@Nullable public Integer getSort()
Gets the sort direction for sorting array elements that are not documents.- Returns:
- the sort direction
- MongoDB documentation
- $sort
- reference/operator/update/sort/#sort-array-elements-that-are-not-documents
-
sort
public PushOptions sort(@Nullable Integer sort)
Sets the sort direction for sorting array elements that are not documents.- Parameters:
sort- the sort direction- Returns:
- this
- Throws:
IllegalStateException- if sortDocument property is already set- MongoDB documentation
- $sort
- reference/operator/update/sort/#sort-array-elements-that-are-not-documents
-
getSortDocument
@Nullable public Bson getSortDocument()
Gets the sort direction for sorting array elements that are documents.- Returns:
- the sort document
- MongoDB documentation
- $sort
-
sortDocument
public PushOptions sortDocument(@Nullable Bson sortDocument)
Sets the sort direction for sorting array elements that are documents.- Parameters:
sortDocument- the sort document- Returns:
- this
- Throws:
IllegalStateException- if sort property is already set- MongoDB documentation
- $sort
-
-