Table of Contents

Method Save

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

Save<TNominalType>(TNominalType)

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<TNominalType>(TNominalType document)

Parameters

document TNominalType

The document to save.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Type Parameters

TNominalType

The type of the document to save.

Save<TNominalType>(TNominalType, 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<TNominalType>(TNominalType document, MongoInsertOptions options)

Parameters

document TNominalType

The document to save.

options MongoInsertOptions

The options to use for this Save.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Type Parameters

TNominalType

The type of the document to save.

Save<TNominalType>(TNominalType, 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<TNominalType>(TNominalType document, WriteConcern writeConcern)

Parameters

document TNominalType

The document to save.

writeConcern WriteConcern

The write concern to use for this Insert.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Type Parameters

TNominalType

The type of the document to save.

Save(Type, object)

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(Type nominalType, object document)

Parameters

nominalType Type

The type of the document to save.

document object

The document to save.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Save(Type, object, 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(Type nominalType, object document, MongoInsertOptions options)

Parameters

nominalType Type

The type of the document to save.

document object

The document to save.

options MongoInsertOptions

The options to use for this Save.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Save(Type, object, 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(Type nominalType, object document, WriteConcern writeConcern)

Parameters

nominalType Type

The type of the document to save.

document object

The document to save.

writeConcern WriteConcern

The write concern to use for this Insert.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).