To be used by backends that require collections to contain Obj, this
looks at type checks on Read
then either eliminates them if they are
trivial, leaves them if they check field contents, or errors if they are
incompatible.
Translate the high-level "logical" plan to an executable MongoDB "physical" plan, taking into account the current runtime environment as captured by the given context.
Translate the high-level "logical" plan to an executable MongoDB "physical" plan, taking into account the current runtime environment as captured by the given context. Internally, the type of the plan being built constrains which operators can be used, but the resulting plan uses the largest, common type so that callers don't need to worry about it.
In QScript mongo we will not remove typecheck filters and this will be deleted.
The selector phase tries to turn expressions into MongoDB selectors -- i.e.
The selector phase tries to turn expressions into MongoDB selectors -- i.e. Mongo query expressions. Selectors are only used for the filtering pipeline op, so it's quite possible we build more stuff than is needed (but it doesn't matter, unneeded annotations will be ignored by the pipeline phase).
Like the expression op phase, this one requires bson field annotations.
Most expressions cannot be turned into selector expressions without using the "$where" operator, which allows embedding JavaScript code. Unfortunately, using this operator turns filtering into a full table scan. We should do a pass over the tree to identify partial boolean expressions which can be turned into selectors, factoring out the leftovers for conversion using $where.