
NotDatabase
Docs
You can read data using find() to fetch multiple documents, and get() to fetch a single document by ID.
find()Use this to query a collection and retrieve multiple documents.
const users = await db.users.find({
filter: { isAdmin: true },
sort: "-createdAt",
limit: 10,
});| Option | Type | Description |
|---|---|---|
filter | Partial<Schema> | Filters by matching fields |
sort | string | Sort by a field (use - prefix for descending) |
limit | number | Max number of results to return |
offset | number | Skips N number of results (for pagination) |
get()Use this to fetch a single document by its ID.
const user = await db.users.get("user_abc123");You can also select specific fields:
const user = await db.users.get("user_abc123", {
select: { name: true, email: true },
});