Table of Contents

Method SetOnInsert

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

SetOnInsert(string, BsonValue)

Sets the value of the named element to the specified value only when an insert occurs as part of an upsert operation (see $setOnInsert).

public UpdateBuilder SetOnInsert(string name, BsonValue value)

Parameters

name string

The name of the element to be set.

value BsonValue

The new value.

Returns

UpdateBuilder

The builder (so method calls can be chained).