Class RemoteFindOneAndModifyOptions
- java.lang.Object
-
- com.mongodb.stitch.core.services.mongodb.remote.RemoteFindOneAndModifyOptions
-
public class RemoteFindOneAndModifyOptions extends Object
The options to apply to a findOneAndUpdate, findOneAndReplace, or findOneAndDelete operation (also commonly referred to as findOneAndModify operations).
-
-
Constructor Summary
Constructors Constructor Description RemoteFindOneAndModifyOptions()
-
Method Summary
Modifier and Type Method Description Bson
getProjection()
Gets a document describing the fields to return for all matching documents.Bson
getSort()
Gets the sort criteria to apply to the query.boolean
isReturnNewDocument()
Returns true if the findOneAndModify operation should return the new document.boolean
isUpsert()
Returns true if a new document should be inserted if there are no matches to the query filter.RemoteFindOneAndModifyOptions
projection(Bson projection)
Sets a document describing the fields to return for all matching documents.RemoteFindOneAndModifyOptions
returnNewDocument(boolean returnNewDocument)
Set to true if findOneAndModify operations should return the new updated document.RemoteFindOneAndModifyOptions
sort(Bson sort)
Sets the sort criteria to apply to the query.String
toString()
RemoteFindOneAndModifyOptions
upsert(boolean upsert)
Set to true if a new document should be inserted if there are no matches to the query filter.
-
-
-
Method Detail
-
getProjection
@Nullable public Bson getProjection()
Gets a document describing the fields to return for all matching documents.- Returns:
- the project document, which may be null
-
projection
public RemoteFindOneAndModifyOptions projection(@Nullable Bson projection)
Sets a document describing the fields to return for all matching documents.- Parameters:
projection
- the project document, which may be null.- Returns:
- this
-
getSort
@Nullable public Bson getSort()
Gets the sort criteria to apply to the query. The default is null, which means that the documents will be returned in an undefined order.- Returns:
- a document describing the sort criteria
-
sort
public RemoteFindOneAndModifyOptions sort(@Nullable Bson sort)
Sets the sort criteria to apply to the query.- Parameters:
sort
- the sort criteria, which may be null.- Returns:
- this
-
isUpsert
public boolean isUpsert()
Returns true if a new document should be inserted if there are no matches to the query filter. The default is false. Note: Only findOneAndUpdate and findOneAndReplace take this option- Returns:
- true if a new document should be inserted if there are no matches to the query filter
-
upsert
public RemoteFindOneAndModifyOptions upsert(boolean upsert)
Set to true if a new document should be inserted if there are no matches to the query filter.- Parameters:
upsert
- true if a new document should be inserted if there are no matches to the query filter.- Returns:
- this
-
isReturnNewDocument
public boolean isReturnNewDocument()
Returns true if the findOneAndModify operation should return the new document. The default is false Note: Only findOneAndUpdate and findOneAndReplace take this options findOneAndDelete will always return the old document- Returns:
- true if findOneAndModify operation should return the new document
-
returnNewDocument
public RemoteFindOneAndModifyOptions returnNewDocument(boolean returnNewDocument)
Set to true if findOneAndModify operations should return the new updated document. Set to false / leave blank to have these operation return the document before the update. Note: Only findOneAndUpdate and findOneAndReplace take this options findOneAndDelete will always return the old document- Parameters:
returnNewDocument
- true if findOneAndModify operations should return the updated document- Returns:
- this
-
-