|
david.storch, the proposal to add min/max to the aggregation subsystem came from a conversation with Charlie and Bernard on the resharding design document.
If I have understood query language semantics correctly, then I believe
{$match: {$expr: {$gte: ["$_id", <resume _id>]}}}
|
wouldn't be subjected to type bracketing. However, we currently don't generate index bounds for {$expr: {$gte}} queries. I think SERVER-39943 is for allowing {$expr: {$gte}} queries to use an index? I want the index bounds to be [<resume _id>, MaxKey].
There was also an exchange between Charlie, Bernard, and me that {$expr: {$gte}} queries may not sort the same way as $sort. I wasn't sure the reason - is it due to array values? We aren't able to specify the {$sort: {_id: 1}} in the collection cloning for resharding pipeline anyway; distributed aggregation planning is unable to push down both a {$sort: {_id: 1}} stage and a {$lookup: {from: {db: "config", coll: "cache.chunks.*"}}} stage to the donor shards as part of the split pipeline. To work around this limitation, the plan is for the merging pipeline to implicitly assume the hint implies a _id:1 sort order and merge the results across different donor shards in sorted order.
|