Guides
Querying
Play with your data
Mongster queries stay close to MongoDB. The main difference is that projections, populate, sorting, and a few other helpers stay typed.
Read queries
import { } from "./models";
const = new ();
const = .({ , : false })
.(["title", "tags", "createdAt"])
.({ : -1 })
.(10)
.(20);
const = await ;find(), findOne(), and findById() return thenable query builders. You can await them directly, but you can also keep building the query before it runs.
Updates and counts
import { } from "./models";
await .({ : }, { : { : true }, : { : "done" } });
const = await .();
const = await .({ : true });
const = await .("ownerId", { : true });Common helpers
include()andexclude()for typed projections.project()when you want to pass a projection record yourself.sort(),skip(), andlimit()for cursor shaping.count(),estimatedCount(), anddistinct()for collection summaries.
Populate has its own guide because refs come with a few important limitations.