createData()
Create a document in the collection with a data field.
Description
Creates a document in the collection with the provided property values in the data field. If the properties data field isn’t provided, the data field isn’t instantiated.
Returns the created document.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
properties |
Yes |
Object describing the document properties and values to include in the data field. |
properties fields
Name | Type | Required | Description |
---|---|---|---|
ttl |
Timestamp indicating when to remove the document.
When the document is removed it ceases to exist and temporal queries
can’t recover the document. |
||
id |
The document |
||
data |
The key:value pairs to populate the data field. If omitted, the data field isn’t instantiated. |
Examples
-
Create a document with a data field:
{ id: "368118064668999714", coll: Books, ts: Time("2023-06-21T04:59:53.710Z"), name: "Then and Now", author: "W. Somerset Maugham", data: { id: "007571098" } }
-
Access the data field:
"007571098"
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!