blob: 51861742ea40a7767bf773afbc277a70dec4f680 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/*
* This is a regression test for SERVER-45508, which was an invariant failure in the query planner.
*
* Previously the invariant would be triggered only when all of these happen together:
* - an index with a collation exists
* - the query planner chooses index bounds with more than one point range
* - the point ranges are indexed in descending order
* - more than one index can satisfy the query
* - the query asks for a sort within each point range
* @tags: [assumes_no_implicit_collection_creation_after_drop]
*/
(function() {
'use strict';
const coll = db.collation_multi_point_range;
coll.drop();
assert.commandWorked(db.createCollection(coll.getName(), {collation: {locale: 'fr'}}));
assert.commandWorked(coll.createIndex({x: -1}));
assert.commandWorked(coll.createIndex({x: -1, y: 1}));
coll.insert({x: 2, y: 99});
assert.commandWorked(coll.find({x: {$in: [2, 5]}}).sort({y: 1}).explain());
assert.eq(1, coll.find({x: {$in: [2, 5]}}).sort({y: 1}).itcount());
})();
|