Read

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,
});

Options

OptionTypeDescription
filterPartial<Schema>Filters by matching fields
sortstringSort by a field (use - prefix for descending)
limitnumberMax number of results to return
offsetnumberSkips 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 },
});