Files
mongo/jstests/core/index/indext.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

22 lines
497 B
JavaScript

// Sparse indexes with arrays SERVER-3216
// @tags: [
// requires_getmore,
// ]
let t = db.jstests_indext;
t.drop();
t.createIndex({"a.b": 1}, {sparse: true});
t.save({a: []});
t.save({a: 1});
assert.eq(0, t.find().hint({"a.b": 1}).itcount());
t.createIndex({"a.b": 1, "a.c": 1}, {sparse: true});
t.save({a: []});
t.save({a: 1});
assert.eq(0, t.find().hint({"a.b": 1, "a.c": 1}).itcount());
t.save({a: [{b: 1}]});
t.save({a: 1});
assert.eq(1, t.find().hint({"a.b": 1, "a.c": 1}).itcount());