Collection.create()
Create a collection.
Description
The Collection.create()
method creates a collection definition
document with the provided data, which must include a unique
collection name.
Collection.create({ name: "Inventory" })
You can’t create a collection and use it in the same query. Use separate queries instead.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
data |
Yes |
Object describing the collection. |
data fields
Name | Type | Required | Description |
---|---|---|---|
name |
Yes |
Name of the collection to create.
|
|
history_days |
Number of days to retain the document in the collection. |
||
ttl_days |
Delete documents |
||
data |
User-defined metadata. |
See also
Collection document definition to delete a collection.
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!