Create a document

Problem

You need to create a document in a collection within the current database.

Solution

Use the Create function:

Copied!
(
  ('dilapidated_huts'),
  { data: { material: 'straw' } }
)
{
  ref: (("dilapidated_huts"), "302044124774662656"),
  ts: 1624310574250000,
  data: { material: 'straw' }
}
Query metrics:
  •    bytesIn:  105

  •   bytesOut:  198

  • computeOps:    1

  •    readOps:    0

  •   writeOps:    1

  •  readBytes:    0

  • writeBytes:  208

  •  queryTime: 37ms

  •    retries:    0

More information

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!