2017-11-28 10:10:44 -05:00
|
|
|
// @tags: [requires_non_retryable_writes]
|
|
|
|
|
|
2011-07-31 08:44:33 -07:00
|
|
|
// Test query empty array SERVER-2258
|
|
|
|
|
|
|
|
|
|
t = db.jstests_arrayfind4;
|
|
|
|
|
t.drop();
|
|
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
t.save({a: []});
|
|
|
|
|
t.ensureIndex({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());
|