Table of Contents

Method Insert

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

Insert(TDefaultDocument)

Inserts a document into this collection (see also InsertBatch to insert multiple documents at once).

public virtual WriteConcernResult Insert(TDefaultDocument document)

Parameters

document TDefaultDocument

The document to insert.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Insert(TDefaultDocument, MongoInsertOptions)

Inserts a document into this collection (see also InsertBatch to insert multiple documents at once).

public virtual WriteConcernResult Insert(TDefaultDocument document, MongoInsertOptions options)

Parameters

document TDefaultDocument

The document to insert.

options MongoInsertOptions

The options to use for this Insert.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).

Insert(TDefaultDocument, WriteConcern)

Inserts a document into this collection (see also InsertBatch to insert multiple documents at once).

public virtual WriteConcernResult Insert(TDefaultDocument document, WriteConcern writeConcern)

Parameters

document TDefaultDocument

The document to insert.

writeConcern WriteConcern

The write concern to use for this Insert.

Returns

WriteConcernResult

A WriteConcernResult (or null if WriteConcern is disabled).