You can manage your collections within the Data Model section of the App's Settings, via the API Collections Endpoint, or directly within the database. If you're unfamiliar with Directus Collections, please start by reading our Understanding Collections docs.
# Creating a Collection
- Navigate to Settings > Data Model
- Click the Create Collection action button in the header
- Enter a unique Collection Name, keeping in mind that this is entered as a key that determines the database table name, and is then presented in the App using the Title Formatter.
- Optional: Configure the collection's Primary Key name and type.
- Auto-Incremented Integer
- Generated UUID
- Manually Entered String
- Optional: Enable and rename any desired System Fields.
- Created On
- Created By
- Updated On
- Updated By
- Click the Finish Setup button
The collection name, primary key name/type, and system field names can not be modified after the collection is created.
Keep in mind that a Directus Collection is just a database table. Therefore you
can import or create a table directly in the database, and it will automatically appear within
Directus. The first time you manage that table, a
directus_collections record will be created with
# Configuring a Collection
# Fields & Layout
- Creating a Field
- Updating a Field
- Deleting a Field
- Duplicating a Field
- Changing Field Order & Layout
# Collection Setup
- Collection Name — This is the key for the collection. It can not be modified, but you can override it with Translations (see below)
- Icon — The icon used throughout the App when referencing this collection
- Note — A helpful note that explains the collection's purpose
- Display Template — A Field Template used to create dynamic titles for the collection's items
- Hidden — Toggles if the collection should be globally hidden. Keep in mind that Admin roles can always see all collections.
- Singleton — Is this collection will only contain a single item (eg: an "About Us" form). When enabled, the Collection Detail will be bypassed, and users are taken directly to the Item Detail page.
- Translation — Allows translating the collection name into different languages. These Schema Translations are important for multilingual projects. You can also "translate" a collection name into the default language — helpful for renaming technical table names.
The archive feature allows you to enable the collection with a custom soft-delete option. Soft-delete allows users to remove items from the App, but maintains the actual database record for easy recovery.
- Archive Field — The field that holds the archive value
- Archive App Filter — Allows users to view archived items
- Archive Value — The value saved in the Archive Field when archived
- Unarchive Value — The value saved in the Archive Field when unarchived
Items that have been archived are still returned normally via the API. It is up to you to filter them out as needed.
When creating a new Collection, you have the option of creating an optional "Status" field. If you choose to include this field, the collection's archive settings will automatically be configured for you.
The sort feature enables manual drag-and-drop item reordering within the Directus App. This is typically shown on the Collection Detail page/modal, and can also be used for sorting items within a Junction Table.
When creating a new Collection, you have the option of creating an optional "Sort" field. If you choose to include this field, the collection's sort settings will automatically be configured for you.
# Deleting a Collection
- Navigate to Settings > Data Model > [Collection Name]
- Click the red Delete Collection action button in the header
- Confirm this decision by clicking Delete in the dialog
This action is permanent and can not be undone. Please proceed with caution.