driver-core/src/main/com/mongodb/client/model/Projections.java
public static Bson slice(final String fieldName, final int limit) {
        return new BsonDocument(fieldName, new BsonDocument("$slice", new BsonInt32(limit)));
    }
public static Bson slice(final String fieldName, final int limit) {
        return new BsonDocument(fieldName, new BsonDocument("$slice", new BsonInt32(limit)));
    }
public static Bson slice ( final String fieldName , final int limit ) { return new BsonDocument ( fieldName , new BsonDocument ( "$slice" , new BsonInt32 ( limit ) ) ) ; }
Creates a projection to the given field name of a slice of the array value of that field.

@param fieldName the field name
@param limit     the number of elements to project.
@return the projection
@mongodb.driver.manual reference/operator/projection/slice Slice
Creates a projection to the given field name of a slice of the array value of that field .