.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.
Arguments
| Arguments | Description |
|---|
data required | The document / record data to insert. |
cancellationToken optional | The cancellationToken enables graceful cancellation of asynchronous operations. |
Example usage
var person = new Person
{
Id = ("person", "tobie"),
Name = "Tobie",
Settings = new Settings
{
Active = true,
Marketing = true,
},
};
var created = await db.Upsert(person);
var updated = await db.Upsert(person);