mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-25 11:49:53 -05:00
With 100K documents optimizes $exists:true/false in the index from 5x -> 10x depending on the query and scenario now that $exists is not a partial match for non-wildcard indexes. The optimization uses a new term, the non-exists term, which is a term with no path `""` and of bson type `undefined`, which is generated when the document doesn't contain a field for the indexed path. This gives us more information when doing index evaluations and we can compare against the non-exist term when doing null equality comparisons or exists checks.