Collection document definition
Fields
Field | Type | Description |
---|---|---|
|
Name of the collection. |
|
|
Document type name: |
|
|
Most recent document update timestamp. |
|
|
(Optional) Document history is retained for at least Default = See Temporality. |
|
|
(Optional) Documents are deleted Default = See Temporality. |
|
|
Indexes defined on the collection. See Indexes definition. |
|
|
Constraints defined on the collection. See Unique constraints definition. |
|
|
Object with metadata fields. |
Examples
Access the collection definition object:
{
name: "Letter",
coll: Collection,
ts: Time("2023-02-19T14:32:29.050Z"),
indexes: {},
constraints: []
}
Collection definitions can be manipulated the same as any other document.
-
Create an index:
{ name: "Letter", coll: Collection, ts: Time("2023-06-21T02:52:39.120Z"), indexes: { rareLetters: { terms: [ { field: "Year" } ], values: [ { field: "Condition", order: "asc" } ], queryable: true, status: "complete" } }, constraints: [] }
-
Delete a collection:
Collection.byName("Letter") /* not found */
This removes the collection, its indexes, and all its documents.
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!