Package com.mongodb.client.model
Class DBCollectionFindAndModifyOptions
- java.lang.Object
-
- com.mongodb.client.model.DBCollectionFindAndModifyOptions
-
public final class DBCollectionFindAndModifyOptions extends Object
The oprtions for find and modify operations.- Since:
- 3.4
-
-
Constructor Summary
Constructors Constructor Description DBCollectionFindAndModifyOptions()
Construct a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DBCollectionFindAndModifyOptions
arrayFilters(List<? extends DBObject> arrayFilters)
Sets the array filters optionDBCollectionFindAndModifyOptions
bypassDocumentValidation(Boolean bypassDocumentValidation)
Sets the bypassDocumentValidationDBCollectionFindAndModifyOptions
collation(Collation collation)
Sets the collationList<? extends DBObject>
getArrayFilters()
Returns the array filters optionBoolean
getBypassDocumentValidation()
Returns the bypassDocumentValidationCollation
getCollation()
Returns the collation optionslong
getMaxTime(TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation.DBObject
getProjection()
Returns the projectionDBObject
getSort()
Returns the sortDBObject
getUpdate()
Returns the updateWriteConcern
getWriteConcern()
Returns the writeConcernboolean
isRemove()
Returns the removeboolean
isUpsert()
Returns the upsertDBCollectionFindAndModifyOptions
maxTime(long maxTime, TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.DBCollectionFindAndModifyOptions
projection(DBObject projection)
Sets the projectionDBCollectionFindAndModifyOptions
remove(boolean remove)
Sets the removeboolean
returnNew()
Returns the returnNewDBCollectionFindAndModifyOptions
returnNew(boolean returnNew)
Sets the returnNewDBCollectionFindAndModifyOptions
sort(DBObject sort)
Sets the sortDBCollectionFindAndModifyOptions
update(DBObject update)
Sets the updateDBCollectionFindAndModifyOptions
upsert(boolean upsert)
Sets the upsertDBCollectionFindAndModifyOptions
writeConcern(WriteConcern writeConcern)
Sets the writeConcern
-
-
-
Method Detail
-
getProjection
@Nullable public DBObject getProjection()
Returns the projection- Returns:
- the projection
-
projection
public DBCollectionFindAndModifyOptions projection(@Nullable DBObject projection)
Sets the projection- Parameters:
projection
- the projection- Returns:
- this
-
sort
public DBCollectionFindAndModifyOptions sort(@Nullable DBObject sort)
Sets the sort- Parameters:
sort
- the sort- Returns:
- this
-
isRemove
public boolean isRemove()
Returns the remove- Returns:
- the remove
-
remove
public DBCollectionFindAndModifyOptions remove(boolean remove)
Sets the remove- Parameters:
remove
- the remove- Returns:
- this
-
update
public DBCollectionFindAndModifyOptions update(@Nullable DBObject update)
Sets the update- Parameters:
update
- the update- Returns:
- this
-
isUpsert
public boolean isUpsert()
Returns the upsert- Returns:
- the upsert
-
upsert
public DBCollectionFindAndModifyOptions upsert(boolean upsert)
Sets the upsert- Parameters:
upsert
- the upsert- Returns:
- this
-
returnNew
public boolean returnNew()
Returns the returnNew- Returns:
- the returnNew
-
returnNew
public DBCollectionFindAndModifyOptions returnNew(boolean returnNew)
Sets the returnNew- Parameters:
returnNew
- the returnNew- Returns:
- this
-
getBypassDocumentValidation
public Boolean getBypassDocumentValidation()
Returns the bypassDocumentValidation- Returns:
- the bypassDocumentValidation
-
bypassDocumentValidation
public DBCollectionFindAndModifyOptions bypassDocumentValidation(Boolean bypassDocumentValidation)
Sets the bypassDocumentValidation- Parameters:
bypassDocumentValidation
- the bypassDocumentValidation- Returns:
- this
-
getMaxTime
public long getMaxTime(TimeUnit timeUnit)
Gets the maximum execution time on the server for this operation. The default is 0, which places no limit on the execution time.- Parameters:
timeUnit
- the time unit to return the result in- Returns:
- the maximum execution time in the given time unit
- MongoDB documentation
- Max Time
-
maxTime
public DBCollectionFindAndModifyOptions maxTime(long maxTime, TimeUnit timeUnit)
Sets the maximum execution time on the server for this operation.- Parameters:
maxTime
- the max timetimeUnit
- the time unit, which may not be null- Returns:
- this
- MongoDB documentation
- Max Time
-
getWriteConcern
@Nullable public WriteConcern getWriteConcern()
Returns the writeConcern- Returns:
- the writeConcern
- Since server release
- 3.2
-
writeConcern
public DBCollectionFindAndModifyOptions writeConcern(@Nullable WriteConcern writeConcern)
Sets the writeConcern- Parameters:
writeConcern
- the writeConcern- Returns:
- this
- Since server release
- 3.2
-
getCollation
public Collation getCollation()
Returns the collation options- Returns:
- the collation options
- Since server release
- 3.4
-
collation
public DBCollectionFindAndModifyOptions collation(Collation collation)
Sets the collation- Parameters:
collation
- the collation- Returns:
- this
- Since server release
- 3.4
-
arrayFilters
public DBCollectionFindAndModifyOptions arrayFilters(List<? extends DBObject> arrayFilters)
Sets the array filters option- Parameters:
arrayFilters
- the array filters, which may be null- Returns:
- this
- Since:
- 3.6
- Since server release
- 3.6
-
-