List all collections

Problem

You need a list of all existing collections within the current database.

Solution

Use the Collections function combined with the Paginate function:

Copied!
(())
{
  data: [
    ("Letters"),
    ("People"),
    ("characters"),
    ("customers"),
    ("decrepit_huts"),
    ("magical_creatures"),
    ("orders"),
    ("posts"),
    ("products"),
    ("spellbooks"),
    ("spells"),
    ("stores"),
    ("users"),
    ("huts")
  ]
}
Query metrics:
  •    bytesIn:    33

  •   bytesOut: 1,003

  • computeOps:     1

  •    readOps:     8

  •   writeOps:     0

  •  readBytes:   796

  • writeBytes:     0

  •  queryTime:  60ms

  •    retries:     0

Discussion

The Paginate function defaults to returning up to 64 collections per page. If your database contains more than 64 collections, you can use the size parameter to retrieve up to 100,000 collections at once.

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!