->upsert()
Creates or updates a record in a table.
Method Syntax
$db->upsert($thing, $data);
Arguments
| Arguments | Type | Description |
|---|
$thing required | RecordId. StringRecordId or string
| The collection to upsert the record to. |
$data required | mixed
| The record to upsert. |
Example
Example
$id = new RecordId('users', 'tobie');
$response = $db->upsert($id, [
'firstname' => 'Tobie',
'lastname' => 'Hitchcock',
]);