driver-core/src/main/com/mongodb/client/model/PushOptions.java
public PushOptions sort(@Nullable final Integer sort) {
        if (sortDocument != null) {
            throw new IllegalStateException("sort can not be set if sortDocument already is");
        }
        this.sort = sort;
        return this;
    }
public PushOptions sort(@Nullable final Integer sort) {
        if (sortDocument != null) {
            throw new IllegalStateException("sort can not be set if sortDocument already is");
        }
        this.sort = sort;
        return this;
    }
Sets the sort direction for sorting array elements that are not documents.

@param sort the sort direction
@return this
@throws IllegalStateException if sortDocument property is already set
@mongodb.driver.manual reference/operator/update/sort/ $sort
@mongodb.driver.manual reference/operator/update/sort/#sort-array-elements-that-are-not-documents