Function: compileExclude()
compileExclude(
where,schema,schemas?,allowRawOperators?):Document[]
Defined in: src/query/compiler.ts:119
Compiles an exclude filter: keep documents that do NOT match the whole where (Django exclude semantics — the conditions are AND-ed, then negated).
Advanced / low-level — see compilePipeline. Prefer Model.objects.exclude(...) in application code.
Relational (ref) conditions negate through an array $lookup + $elemMatch rather than the $unwind used by filter(). This is deliberate: $unwind drops parents that have no related document, but exclude(rel__field=x) must keep those parents (there is no related object that matches, so they aren't excluded). A temporary lookup field is added, used by the negation, then $unset. Only a single relational hop is supported; a multi-hop relational exclude throws.
Parameters
where
Record<string, unknown>
schema
schemas?
Record<string, SchemaDef>
allowRawOperators?
boolean
Returns
Document[]