replace()
Replace all document fields.
Description
The replace()
method replaces all fields with object, except
for the immutable metadata fields id
, coll
, and ts
. Fields not
present in object, except immutable metadata fields, are removed
from the document.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
object |
Yes |
Object with the replacement document fields. |
Examples
Given the following document:
{
id: "392886847463751746",
coll: Product,
ts: Time("2099-04-10T16:50:12.850Z"),
name: "limes",
description: "Organic, 1 ct",
price: 0.65
}
Call replace()
with a replacement document object:
{
id: "392886847463751746",
coll: Product,
ts: Time("2024-04-10T17:54:37.670Z"),
name: "limes",
description: "Organic, 2 ct",
price: 0.99,
quantity: 50
}
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!