Package com.mongodb.client.model
Class PushOptions
- java.lang.Object
-
- com.mongodb.client.model.PushOptions
-
public class PushOptions extends java.lang.Object
The options to apply to a $push update operator.- Since:
- 3.1
- See Also:
Updates.pushEach(String, java.util.List, PushOptions)
-
-
Constructor Summary
Constructors Constructor Description PushOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Integer
getPosition()
Gets the position at which to add the pushed values in the array.java.lang.Integer
getSlice()
Gets the slice value, which is the limit on the number of array elements allowed.java.lang.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.PushOptions
position(java.lang.Integer position)
Sets the position at which to add the pushed values in the array.PushOptions
slice(java.lang.Integer slice)
Sets the limit on the number of array elements allowed.PushOptions
sort(java.lang.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.java.lang.String
toString()
-
-
-
Method Detail
-
getPosition
@Nullable public java.lang.Integer getPosition()
Gets the position at which to add the pushed values in the array.- Returns:
- the position, which may be null
-
position
public PushOptions position(@Nullable java.lang.Integer position)
Sets the position at which to add the pushed values in the array.- Parameters:
position
- the position- Returns:
- this
-
getSlice
@Nullable public java.lang.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
-
slice
public PushOptions slice(@Nullable java.lang.Integer slice)
Sets the limit on the number of array elements allowed.- Parameters:
slice
- the limit- Returns:
- this
-
getSort
@Nullable public java.lang.Integer getSort()
Gets the sort direction for sorting array elements that are not documents.- Returns:
- the sort direction
-
sort
public PushOptions sort(@Nullable java.lang.Integer sort)
Sets the sort direction for sorting array elements that are not documents.- Parameters:
sort
- the sort direction- Returns:
- this
- Throws:
java.lang.IllegalStateException
- if sortDocument property is already set
-
getSortDocument
@Nullable public Bson getSortDocument()
Gets the sort direction for sorting array elements that are documents.- Returns:
- the sort document
-
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:
java.lang.IllegalStateException
- if sort property is already set
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-