replace()
Replace the existing fields with the provided fields.
Description
The replace()
method replaces the collection fields with the provided
object.
You can’t replace a collection’s definition and write to documents in the collection in the same query. Use separate queries instead.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
object |
Yes |
Replacement Collection fields. |
Examples
-
View the current document:
{ id: "387120252471738436", coll: Customer, ts: Time("2024-01-16T22:51:32.170Z"), firstName: "A", lastName: "Appleseed" }
-
Replace the current document fields:
{ id: "387120252471738436", coll: Customer, ts: Time("2024-01-16T22:56:15.825Z"), identifier: "00123" }
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!