Replace
Replace( ref, param_object )
Description
The replace
operation substitutes the user data pointed to by the
reference with the data contained in the param_object
. Values not
specified in the param_object
are removed.
For performance, the documents describing AccessProviders, Databases,
Collections, Functions, Indexes, Keys, Roles, and Tokens use an object
cache. When you use This does not apply to non-schema documents, such as those in a user-created collection. Non-schema documents are always modified or removed in a strongly consistent manner. |
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
A Reference to the document that should be modified. |
|
|
An Object that containing the document’s user data to be modified. See the following section for details. |
Returns
Examples
The following query updates the document by changing the name field to the value "Mountains’s Thunder", and removing the "cost" field from the document:
{
ref: Ref(Collection("spells"), "181388642581742080"),
ts: 1624310504150000,
data: { name: "Mountain's Thunder", element: [ 'air', 'earth' ] }
}
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!