Search the docs
.Upsert<T>()
Creates or updates a specific record.
Method Syntax
await db.Upsert<T>(data)
This function creates a new document / record or replaces the current one with the specified data.
data
cancellationToken
var person = new Person{ Id = ("person", "tobie"), // Id is mandatory to apply create or update Name = "Tobie", Settings = new Settings { Active = true, Marketing = true, },};// Create a new record when it doesn't existvar created = await db.Upsert(person);// Update an existing record when it does existvar updated = await db.Upsert(person);
Previous
Update
Next
Use