updateOne

inline suspend fun MongoCollection<*>.updateOne(filter: BsonDocument, update: BsonDocument, upsert: Boolean = false): UpdateOneResult

Update or insert a single object in the remote collection.

Return

the result of the updateOne operation.

Parameters

filter

a filter to select the document to update.

update

a BsonDocument specifying the updates that should be applied to the document.

upsert

a boolean indicating if a new document should be inserted if the filter does not match any existing documents in the collection.

Throws

if the underlying App Service HTTP requests fails.

SerializationException

if App Service response could not be deserialized to UpdateOneResult.