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