Table of Contents

Method SetElement

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

SetElement(BsonElement)

Sets an element of the document (replaces any existing element with the same name or adds a new element if an element with the same name is not found).

public override BsonDocument SetElement(BsonElement element)

Parameters

element BsonElement

The new element.

Returns

BsonDocument

The document.

SetElement(int, BsonElement)

Sets an element of the document (replacing the existing element at that position).

public override BsonDocument SetElement(int index, BsonElement element)

Parameters

index int

The zero based index of the element to replace.

element BsonElement

The new element.

Returns

BsonDocument

The document.