Collection metadata

Problem

You need to store additional metadata in a collection document.

Solution

Set the data field in a collection:

Copied!
(
  ('dilapidated_huts'),
  { data: { env: 'test' } }
)
{
  ref: ("dilapidated_huts"),
  ts: 1635183253930000,
  history_days: 30,
  name: 'dilapidated_huts',
  data: { env: 'test' }
}
Query metrics:
  •    bytesIn:   99

  •   bytesOut:  186

  • computeOps:    1

  •    readOps:    0

  •   writeOps:    1

  •  readBytes:  227

  • writeBytes:  113

  •  queryTime: 18ms

  •    retries:    0

Discussion

Adding metadata to a collection can be used to store any information that helps to distinguish the collection from other collections.

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!