Skip to main content

Query operators

Reference for the public filter operators supported by the unified query grammar and filesystem provider.

Use these operators inside the where option accepted by many(), paginate(), and navigation(). Import the QueryWhere type from @lupinum/ginko-content/client or @lupinum/ginko-content/server.

Provider-backed queries may use only comparison operators advertised by that provider. $and, $or, and $not are mandatory structural nodes in the provider wire rather than optional capabilities.

Operators

OperatorPurposeExample
$eqEqual{ status: { $eq: 'published' } }
$neNot equal{ draft: { $ne: true } }
$gtGreater than{ order: { $gt: 10 } }
$gteGreater than or equal{ order: { $gte: 10 } }
$ltLess than{ order: { $lt: 20 } }
$lteLess than or equal{ order: { $lte: 20 } }
$inValue belongs to a set{ status: { $in: ['draft', 'review'] } }
$ninValue does not belong to a set{ status: { $nin: ['archived'] } }
$containsString or array contains a value{ tags: { $contains: 'nuxt' } }
$containsAnyArray contains at least one value{ tags: { $containsAny: ['nuxt', 'vue'] } }
$icontainsCase-insensitive string containment{ title: { $icontains: 'ginko' } }
$existsField presence matches a boolean{ image: { $exists: true } }
$typeRuntime value has the requested type{ order: { $type: 'number' } }
$prefixString begins with a prefix{ path: { $prefix: '/blog/2026' } }

$type accepts string, number, boolean, object, or undefined.

Logical groups

ts
const result = await many(posts, {
  where: {
    $and: [
      { draft: { $ne: true } },
      {
        $or: [
          { tags: { $contains: 'nuxt' } },
          { title: { $icontains: 'content' } }
        ]
      }
    ]
  }
})

Negation is a logical group rather than a field operator:

ts
await many(posts, {
  where: {
    $not: { tags: { $contains: 'internal' } }
  }
})

Direct equality

A field may use a direct value when no operator is needed:

ts
await many(posts, {
  where: { featured: true }
})

This is equivalent to $eq for that value.

Provider capabilities

The filesystem provider supports the public operator set documented here plus provider-internal regex matching. External providers advertise a subset in capabilities.query.operators and must prove each advertised operator through the provider contract suite. Every v4 provider also interprets structural and, or, and not plan nodes. Provider capabilities do not expand the public TypeScript or HTTP grammar.

Requesting an unsupported operator is an error. Ginko does not fetch all records and emulate provider behavior silently.

Non-public operators

Internal query transport names and legacy fluent-builder operators are not part of the unified public grammar. Public queries reject caller-provided $regex and $options; string SQL-style operators are also not public where syntax.

The query API documents which operations accept where. Provider authors must keep advertised capabilities synchronized with the provider contract suite.