|
We have a QueryPattern class that categorizes the constraints for the fields of a query. The current categories are Equality, UpperBound, LowerBound, and UpperAndLowerBound. A constraint is determined to be an UpperBound constraint if the maximum matching BSONElement is not MaxKey but the minimum matching BSONElement is MinKey, and corresponding rules determine the remaining inequality bound categories.
We also have a type bracketing policy for some query operators, where matches must be the same canonical type as the query value. For example, in the query {a:{$lt:5}} the smallest matching BSONElement is the smallest number we can represent rather than MinKey. This means that $lt:5 will mapped to the bound category UpperAndLowerBound because of the way its index range is bounded on both sides. We might want classify such cases as UpperBound instead, since the lower bound is created by type bracketing rather than an explicit query constraint.
|