Class Update.PushOperatorBuilder

java.lang.Object
org.springframework.data.mongodb.core.query.Update.PushOperatorBuilder
Enclosing class:
Update

public class Update.PushOperatorBuilder extends Object
Builder for creating $push modifiers
Author:
Christoph Strobl, Thomas Darimont
  • Method Details

    • each

      public Update each(Object... values)
      Propagates $each to $push
      Parameters:
      values -
      Returns:
      never null.
    • slice

      public Update.PushOperatorBuilder slice(int count)
      Propagates $slice to $push. $slice requires the $each operator.
      If count is zero, $slice updates the array to an empty array.
      If count is negative, $slice updates the array to contain only the last count elements.
      If count is positive, $slice updates the array to contain only the first count elements.
      Parameters:
      count -
      Returns:
      never null.
      Since:
      1.10
    • sort

      public Update.PushOperatorBuilder sort(Sort.Direction direction)
      Propagates $sort to $push. $sort requires the $each operator. Forces elements to be sorted by values in given direction.
      Parameters:
      direction - must not be null.
      Returns:
      never null.
      Since:
      1.10
    • sort

      public Update.PushOperatorBuilder sort(Sort sort)
      Propagates $sort to $push. $sort requires the $each operator. Forces document elements to be sorted in given order.
      Parameters:
      sort - must not be null.
      Returns:
      never null.
      Since:
      1.10
    • atPosition

      public Update.PushOperatorBuilder atPosition(int position)
      Forces values to be added at the given position.
      Parameters:
      position - the position offset. As of MongoDB 3.6 use a negative value to indicate starting from the end, counting (but not including) the last element of the array.
      Returns:
      never null.
      Since:
      1.7
    • atPosition

      Forces values to be added at given position.
      Parameters:
      position - can be null which will be appended at the last position.
      Returns:
      never null.
      Since:
      1.7
    • value

      public Update value(Object value)
      Propagates value(Object) to $push
      Parameters:
      value -
      Returns:
      never null.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object