Table of Contents

Method Save

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

Save(TDefaultDocument)

Saves a document to this collection. The document must have an identifiable Id field. Based on the value of the Id field Save will perform either an Insert or an Update.

public virtual WriteConcernResult Save(TDefaultDocument document)

Parameters

document TDefaultDocument

The document to save.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Save(TDefaultDocument, MongoInsertOptions)

Saves a document to this collection. The document must have an identifiable Id field. Based on the value of the Id field Save will perform either an Insert or an Update.

public virtual WriteConcernResult Save(TDefaultDocument document, MongoInsertOptions options)

Parameters

document TDefaultDocument

The document to save.

options MongoInsertOptions

The options to use for this Save.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Save(TDefaultDocument, WriteConcern)

Saves a document to this collection. The document must have an identifiable Id field. Based on the value of the Id field Save will perform either an Insert or an Update.

public virtual WriteConcernResult Save(TDefaultDocument document, WriteConcern writeConcern)

Parameters

document TDefaultDocument

The document to save.

writeConcern WriteConcern

The write concern to use for this Insert.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).