Collections
Create and manage collections in your CassaDB project.
Collections organize your documents into logical groups such as users, products, or orders. A collection is created once and can store any number of documents.
Create a Collection
Create a new collection.
ts
const users = await db.collections.create({
name: "users",
});Parameters
- name (string) — Unique collection name within the project.
Returns
ts
{
id: "col_01JY...",
name: "users",
createdAt: "2026-07-11T09:21:43Z"
}List Collections
Retrieve all collections in the current project.
ts
const collections = await db.collections.list();Returns
ts
[
{
id: "col_01JY...",
name: "users"
},
{
id: "col_01JZ...",
name: "products"
}
]Find a Collection
Retrieve a collection by its ID.
ts
const collection = await db.collections.find(
"col_01JY..."
);Returns
ts
{
id: "col_01JY...",
name: "users"
}Delete a Collection
Delete a collection and all of its documents.
ts
await db.collections.delete(
"col_01JY..."
);Deleting a collection permanently removes every document stored inside it. This action cannot be undone.
Example
ts
const users = await db.collections.create({
name: "users",
});
const collections =
await db.collections.list();
const found =
await db.collections.find(users.id);
await db.collections.delete(users.id);