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 boolean
equalsβ(Object o)
Integer
getPosition()
Gets the position at which to add the pushed values in the array.Integer
getSlice()
Gets the slice value, which is the limit on the number of array elements allowed.Integer
getSort()
Gets the sort direction for sorting array elements that are not documents.Bson
getSortDocument()
Gets the sort direction for sorting array elements that are documents.int
hashCode()
PushOptions
positionβ(Integer position)
Sets the position at which to add the pushed values in the array.PushOptions
sliceβ(Integer slice)
Sets the limit on the number of array elements allowed.PushOptions
sortβ(Integer sort)
Sets the sort direction for sorting array elements that are not documents.PushOptions
sortDocumentβ(Bson sortDocument)
Sets the sort direction for sorting array elements that are documents.String
toString()
-
-
-
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
-
-