Docs Menu
Docs Home
/ /
Atlas Device SDKs
/ / /

Class FindOneAndModifyOptions

On this page

  • io.realm.mongodb.mongo.options
  • Constructors
  • Method Summary
  • Inherited Methods
  • Constructor Detail
  • Method Detail
  • getProjection
  • getSort
  • isReturnNewDocument
  • isUpsert
  • projection
  • returnNewDocument
  • sort
  • toString
  • upsert
java.lang.Object
io.realm.mongodb.mongo.options.FindOneAndModifyOptions

The options to apply to a findOneAndUpdate, findOneAndReplace, or findOneAndDelete operation (also commonly referred to as findOneAndModify operations).

Constructor and Description
Modifier and Type
Method and Description
public Bson

Gets a document describing the fields to return for all matching documents.

public Bson

Gets the sort criteria to apply to the query.

public boolean

Returns true if the findOneAndModify operation should return the new document.

public boolean

Returns true if a new document should be inserted if there are no matches to the query filter.

Bson projection
)

Sets a document describing the fields to return for all matching documents.

boolean returnNewDocument
)

Set to true if findOneAndModify operations should return the new updated document.

Bson sort
)

Sets the sort criteria to apply to the query.

public String
boolean upsert
)

Set to true if a new document should be inserted if there are no matches to the query filter.

  • Methods inherited from class java.lang.Object : getClass , hashCode , equals , clone , toString , notify , notifyAll , wait , wait , wait , finalize

public Bson getProjection ()

Gets a document describing the fields to return for all matching documents.

Returns

the project document, which may be null

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

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

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

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

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

Bson sort
)

Sets the sort criteria to apply to the query.

Parameters

  • sort - the sort criteria, which may be null.

Returns

this

public String toString ()

Overrides

toString in class Object

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

Back

CountOptions