public final class UpdateRequest extends WriteRequest
WriteRequest.Type
Constructor and Description |
---|
UpdateRequest(BsonDocument filter,
BsonDocument update,
WriteRequest.Type updateType)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
UpdateRequest |
arrayFilters(java.util.List<BsonDocument> arrayFilters)
Sets the array filters option
|
UpdateRequest |
collation(Collation collation)
Sets the collation options
|
java.util.List<BsonDocument> |
getArrayFilters()
Returns the array filters option
|
Collation |
getCollation()
Returns the collation options
|
BsonDocument |
getFilter()
Gets the query filter for the update.
|
WriteRequest.Type |
getType()
Gets the type of the write.
|
BsonDocument |
getUpdate()
Gets the update.
|
boolean |
isMulti()
Gets whether this update will update all documents matching the filter.
|
boolean |
isUpsert()
Gets whether this update will insert a new document if no documents match the filter.
|
UpdateRequest |
multi(boolean isMulti)
Sets whether this will update all documents matching the query filter.
|
UpdateRequest |
upsert(boolean isUpsert)
Sets whether this update will insert a new document if no documents match the filter.
|
public UpdateRequest(BsonDocument filter, BsonDocument update, WriteRequest.Type updateType)
filter
- the non-null query filterupdate
- the non-null update operationsupdateType
- the update type, which must be either UPDATE or REPLACEpublic WriteRequest.Type getType()
WriteRequest
getType
in class WriteRequest
public BsonDocument getFilter()
public BsonDocument getUpdate()
public boolean isMulti()
public UpdateRequest multi(boolean isMulti)
isMulti
- whether this will update all documents matching the query filterpublic boolean isUpsert()
public UpdateRequest upsert(boolean isUpsert)
isUpsert
- whether this update will insert a new document if no documents match the filterpublic Collation getCollation()
public UpdateRequest collation(Collation collation)
A null value represents the server default.
collation
- the collation options to usepublic UpdateRequest arrayFilters(java.util.List<BsonDocument> arrayFilters)
arrayFilters
- the array filters, which may be nullpublic java.util.List<BsonDocument> getArrayFilters()