Table of Contents

Method Update

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.Legacy.dll

Update(IMongoQuery, IMongoUpdate)

Updates one matching document in this collection.

public virtual WriteConcernResult Update(IMongoQuery query, IMongoUpdate update)

Parameters

query IMongoQuery

The query (usually a QueryDocument or constructed using the Query builder).

update IMongoUpdate

The update to perform on the matching document.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Update(IMongoQuery, IMongoUpdate, MongoUpdateOptions)

Updates one or more matching documents in this collection (for multiple updates use UpdateFlags.Multi).

public virtual WriteConcernResult Update(IMongoQuery query, IMongoUpdate update, MongoUpdateOptions options)

Parameters

query IMongoQuery

The query (usually a QueryDocument or constructed using the Query builder).

update IMongoUpdate

The update to perform on the matching document.

options MongoUpdateOptions

The update options.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Update(IMongoQuery, IMongoUpdate, WriteConcern)

Updates one matching document in this collection.

public virtual WriteConcernResult Update(IMongoQuery query, IMongoUpdate update, WriteConcern writeConcern)

Parameters

query IMongoQuery

The query (usually a QueryDocument or constructed using the Query builder).

update IMongoUpdate

The update to perform on the matching document.

writeConcern WriteConcern

The write concern to use for this Insert.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Update(IMongoQuery, IMongoUpdate, UpdateFlags)

Updates one or more matching documents in this collection (for multiple updates use UpdateFlags.Multi).

public virtual WriteConcernResult Update(IMongoQuery query, IMongoUpdate update, UpdateFlags flags)

Parameters

query IMongoQuery

The query (usually a QueryDocument or constructed using the Query builder).

update IMongoUpdate

The update to perform on the matching document.

flags UpdateFlags

The flags for this Update.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Update(IMongoQuery, IMongoUpdate, UpdateFlags, WriteConcern)

Updates one or more matching documents in this collection (for multiple updates use UpdateFlags.Multi).

public virtual WriteConcernResult Update(IMongoQuery query, IMongoUpdate update, UpdateFlags flags, WriteConcern writeConcern)

Parameters

query IMongoQuery

The query (usually a QueryDocument or constructed using the Query builder).

update IMongoUpdate

The update to perform on the matching document.

flags UpdateFlags

The flags for this Update.

writeConcern WriteConcern

The write concern to use for this Insert.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).