Melon-dbMelon-db
Walkthroughs

Query surfaces

Fluent builder, Mango, and Prisma-style queries on one engine.

All surfaces compile to the same QueryAst and execute through @melon-db/db.

Where to try

SurfaceExample location
Fluent (@melon-db/db-query)playground-rn-dev Query demos, playground-web
Mango (@melon-db/db-query-mango)playground-rn-dev Demos screen
Prisma-style (@melon-db/db-prisma)useFindMany with where / orderBy / include in rn-dev

Fluent

const q = createQueryFactory(schema);
const ast = q.from<Task>('tasks').where('status', 'eq', 'open').toAst();
await db.collection('tasks').query(ast).fetch();

Mango

const compiler = createMangoCompiler();
const prepared = compiler.compile(
  { selector: { status: 'open' }, limit: 10 },
  schema,
  'tasks',
);

Prisma-style

const rows = await useFindMany<Task>('tasks', {
  where: { status: 'open' },
  orderBy: { priority: 'desc' },
  take: 5,
});

Verify

  • Open tasks from fluent and Mango hooks match in rn-dev demos.
  • Devtools shows source: melon | mango | prisma on query snapshots.
  • Unsupported operators fail at compile time (see Mango package README).