Files
mongo/jstests/core/query/array/arrayfind4.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1022 B
JavaScript
Raw Normal View History

// @tags: [
// requires_non_retryable_writes,
// requires_getmore,
// # Time series collections do not support indexing array values in measurement fields.
// exclude_from_timeseries_crud_passthrough,
// ]
2011-07-31 08:44:33 -07:00
// Test query empty array SERVER-2258
let t = db.jstests_arrayfind4;
t.drop();
t.save({a: []});
t.createIndex({a: 1});
2011-07-31 08:44:33 -07: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
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
t.remove({});
t.save({a: [[]]});
2011-07-31 08:44:33 -07: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
assert.eq(
1,
t
.find({a: {$in: [[]]}})
.hint({$natural: 1})
.itcount(),
);
assert.eq(
1,
t
.find({a: {$in: [[]]}})
.hint({a: 1})
.itcount(),
);