Optional
$and?: StrictFilter<Schema>[]Optional
$not?: StrictFilter<Schema>Optional
$or?: StrictFilter<Schema>[]Optional
_id?: FilterExpr<IdOf<Schema>>interface BasicSchema {
arr: string[],
num: number,
}
db.collection<BasicSchema>('coll_name').findOne({
$and: [
{ _id: { $in: ['abc', 'def'] } },
{ $not: { arr: { $size: 0 } } },
]
} satisfies StrictFilter<BasicSchema>);
Filter
Represents some filter operation for a given document schema.
If you want relaxed type-checking, see Filter.
This is a stricter version of Filter that type-checks nested fields.
You can use it anywhere by using the
satisfies
keyword, or by creating a temporary const with the StrictFilter type.