List all collections
Solution
Use the Collections
function combined with the Paginate
function:
ObjectV(data: Arr(RefV(id = "Letters", collection = RefV(id = "collections")), RefV(id = "People", collection = RefV(id = "collections")), RefV(id = "characters", collection = RefV(id = "collections")), RefV(id = "customers", collection = RefV(id = "collections")), RefV(id = "decrepit_huts", collection = RefV(id = "collections")), RefV(id = "magical_creatures", collection = RefV(id = "collections")), RefV(id = "orders", collection = RefV(id = "collections")), RefV(id = "posts", collection = RefV(id = "collections")), RefV(id = "products", collection = RefV(id = "collections")), RefV(id = "spellbooks", collection = RefV(id = "collections")), RefV(id = "spells", collection = RefV(id = "collections")), RefV(id = "stores", collection = RefV(id = "collections")), RefV(id = "users", collection = RefV(id = "collections")), RefV(id = "huts", collection = RefV(id = "collections"))))
map[data:[{Letters 0xc0001097a0 0xc0001097a0 <nil>} {People 0xc000109890 0xc000109890 <nil>} {characters 0xc000109980 0xc000109980 <nil>} {customers 0xc000109a70 0xc000109a70 <nil>} {decrepit_huts 0xc000109b60 0xc000109b60 <nil>} {magical_creatures 0xc000109c50 0xc000109c50 <nil>} {orders 0xc000109d40 0xc000109d40 <nil>} {posts 0xc000109e30 0xc000109e30 <nil>} {products 0xc000109f20 0xc000109f20 <nil>} {spellbooks 0xc000172030 0xc000172030 <nil>} {spells 0xc000172120 0xc000172120 <nil>} {stores 0xc000172210 0xc000172210 <nil>} {users 0xc000172300 0xc000172300 <nil>} {huts 0xc0001723f0 0xc0001723f0 <nil>}]]
{data: [ref(id = "Letters", collection = ref(id = "collections")), ref(id = "People", collection = ref(id = "collections")), ref(id = "characters", collection = ref(id = "collections")), ref(id = "customers", collection = ref(id = "collections")), ref(id = "decrepit_huts", collection = ref(id = "collections")), ref(id = "magical_creatures", collection = ref(id = "collections")), ref(id = "orders", collection = ref(id = "collections")), ref(id = "posts", collection = ref(id = "collections")), ref(id = "products", collection = ref(id = "collections")), ref(id = "spellbooks", collection = ref(id = "collections")), ref(id = "spells", collection = ref(id = "collections")), ref(id = "stores", collection = ref(id = "collections")), ref(id = "users", collection = ref(id = "collections")), ref(id = "huts", collection = ref(id = "collections"))]}
{
data: [
Collection("Letters"),
Collection("People"),
Collection("characters"),
Collection("customers"),
Collection("decrepit_huts"),
Collection("magical_creatures"),
Collection("orders"),
Collection("posts"),
Collection("products"),
Collection("spellbooks"),
Collection("spells"),
Collection("stores"),
Collection("users"),
Collection("huts")
]
}
{'data': [Ref(id=Letters, collection=Ref(id=collections)), Ref(id=People, collection=Ref(id=collections)), Ref(id=characters, collection=Ref(id=collections)), Ref(id=customers, collection=Ref(id=collections)), Ref(id=decrepit_huts, collection=Ref(id=collections)), Ref(id=magical_creatures, collection=Ref(id=collections)), Ref(id=orders, collection=Ref(id=collections)), Ref(id=posts, collection=Ref(id=collections)), Ref(id=products, collection=Ref(id=collections)), Ref(id=spellbooks, collection=Ref(id=collections)), Ref(id=spells, collection=Ref(id=collections)), Ref(id=stores, collection=Ref(id=collections)), Ref(id=users, collection=Ref(id=collections)), Ref(id=huts, collection=Ref(id=collections))]}
{
data: [
Collection("Letters"),
Collection("People"),
Collection("characters"),
Collection("customers"),
Collection("decrepit_huts"),
Collection("magical_creatures"),
Collection("orders"),
Collection("posts"),
Collection("products"),
Collection("spellbooks"),
Collection("spells"),
Collection("stores"),
Collection("users"),
Collection("huts")
]
}
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.
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!