Retrieve a single collection

Problem

You need to retrieve a the document that describes a collection from the current database.

Solution

Use the Get function:

Copied!
client.query(
  q.(q.('huts'))
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
{
  ref: ("huts"),
  ts: 1622573894320000,
  history_days: 30,
  name: 'huts'
}
Query metrics:
  •    bytesIn:   29

  •   bytesOut:  140

  • computeOps:    1

  •    readOps:    1

  •   writeOps:    0

  •  readBytes:   68

  • writeBytes:    0

  •  queryTime: 21ms

  •    retries:    0

Discussion

A collection document describes the container that contains documents; it is not the container itself.

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!