Work with Collections
Collections form the basis for interacting with the Macrometa GDN, allowing you to perform various actions on your data. Let's go over some tasks you can perform with collections.
Create a New Collection
When viewing your collections, you can click New Collection to create a new collection.
- Create a Document Collection
- Create a Key-Value Collection
- Create a Redis Mode
- Create a Dynamo Table
- Create a Graph Edge
View Collections
- Web Console
- REST API
- CLI
- Log in to your Macrometa account.
- Click Data > Collections.
This displays a list of collections. The following columns show information about each collection.
Field Name | Description |
---|---|
Collection Name | The list of all collections you have access to, sorted alphabetically. |
Data Model | Displays the type of each collection. |
Stream Enabled | Shows whether a collection stream is enabled (Yes) or not enabled (No). You can change this in the collection Data tab. |
Distribution | When a collection is created, it can be locally or globally distributed across Macrometa servers. This section displays the distribution type for your collections - Local or Global. |
Filter Collections | If you have many collections, then it can be helpful to filter your collection list so that you have fewer to sort through. |
Filter Collections
The GDN allows you to filter collections by name or by type.
- Filter Collections by Name : Enter the name of the collection into the search bar to filter your collections.
- Filter Collections by Type : Click on the desired collection type to get a list of all the collections matching the type. The following filters for key-value collections.
Use our interactive API Reference to:
Use the gdnsl collection list CLI command to see what collections exist.
Use the gdnsl collection describe CLI command to learn more about a specific collection.
Output from these commands looks similar to the following:
MacBook-Pro ~ % gdnsl collection list
┌────────┐
│ Name │
├────────┤
│ edges │
│ docs │
│ dynamo │
│ kv │
│ redis │
└────────┘
MacBook-Pro ~ % gdnsl collection describe kv
{
"error": false,
"code": 200,
"waitForSync": false,
"name": "kv",
"isSystem": false,
"isSpot": false,
"isLocal": false,
"status": 3,
"searchEnabled": false,
"id": "27025010960",
"type": 2,
"hasStream": true,
"globallyUniqueId": "hC835CABCFA79/27025010960",
"collectionModel": "KV"
}
Truncate a Collection
Truncating a collection removes all the documents from the collection but leaves the indexes in place. This is available for all collection types, except a Dynamo Table.
To truncate a collection:
- Log in to your Macrometa account.
- Click Data > Collections.
- Click the collection that you want to truncate.
- Click Settings.
- In the Settings tab, click Truncate Collection.
Delete a Collection
Unlike truncating a collection, deleting a collection removes all the content, including the indexes.
To delete a collection:
- Log in to your Macrometa account.
- Click Data > Collections.
- Click the collection that you want to delete.
- Click Settings.
- In the Settings tab, click Delete Collection.