2020-08-13 19:13:40 -04:00
|
|
|
// @tags: [
|
|
|
|
|
// requires_non_retryable_writes,
|
|
|
|
|
// ]
|
2017-11-28 10:10:44 -05:00
|
|
|
|
2011-07-31 08:44:33 -07:00
|
|
|
// Test query empty array SERVER-2258
|
|
|
|
|
|
2023-05-07 16:15:25 +00:00
|
|
|
let t = db.jstests_arrayfind4;
|
2011-07-31 08:44:33 -07:00
|
|
|
t.drop();
|
|
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
t.save({a: []});
|
2020-11-17 13:45:05 +00:00
|
|
|
t.createIndex({a: 1});
|
2011-07-31 08:44:33 -07:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
assert.eq(1, t.find({a: []}).hint({$natural: 1}).itcount());
|
|
|
|
|
assert.eq(1, t.find({a: []}).hint({a: 1}).itcount());
|
2011-07-31 08:44:33 -07:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
assert.eq(1, t.find({a: {$in: [[]]}}).hint({$natural: 1}).itcount());
|
|
|
|
|
assert.eq(1, t.find({a: {$in: [[]]}}).hint({a: 1}).itcount());
|
2011-07-31 08:44:33 -07:00
|
|
|
|
2014-02-02 11:21:12 -05:00
|
|
|
t.remove({});
|
2016-03-09 12:17:50 -05:00
|
|
|
t.save({a: [[]]});
|
2011-07-31 08:44:33 -07:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
assert.eq(1, t.find({a: []}).hint({$natural: 1}).itcount());
|
|
|
|
|
assert.eq(1, t.find({a: []}).hint({a: 1}).itcount());
|
2011-07-31 08:44:33 -07:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
assert.eq(1, t.find({a: {$in: [[]]}}).hint({$natural: 1}).itcount());
|
|
|
|
|
assert.eq(1, t.find({a: {$in: [[]]}}).hint({a: 1}).itcount());
|