Skip to main content

πŸ” Query Manager: Direct Database Power!

Sometimes you want to work with raw collectionsβ€”no models, no frills, just pure MongoDB power. That's where Cascade's Query manager shines! πŸš€

🧰 What is the Query Manager?​

  • A direct, flexible way to run queries on any collection
  • Perfect for scripts, migrations, admin tools, or when you don't need a full model
  • Gives you access to all the CRUD operations, filtering, aggregation, and more

πŸ—οΈ Basic Usage​

Import the query instance and go:

src/app.ts
import { query } from "@warlock.js/cascade";

const users = await query.list("users");

You can filter, sort, count, aggregate, and moreβ€”just pass the collection name and your options!

πŸ€” When to Use Query Manager vs Models?​

  • Use Models for business logic, events, casting, and relationships
  • Use Query Manager for quick scripts, admin dashboards, migrations, or when you want full control

πŸ§™β€β™‚οΈ Pro Tip​

You can mix and match! Use models for most of your app, and drop down to the Query manager for power-user tasks.


🌟 What's Next?​