Files
mongo/jstests/aggregation/optimization/distinct_like_group_rooted_or.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

19 lines
532 B
JavaScript

/**
* Ensures that distinct queries run correctly with a rooted $or.
*/
// TODO SERVER-101473: This generates two fetch nodes, we should fix that.
const collName = jsTestName();
const coll = db[collName];
coll.drop();
assert.commandWorked(coll.insert({}));
assert.commandWorked(coll.createIndex({t: 1, m: 1}));
assert.commandWorked(
db.runCommand({
aggregate: jsTestName(),
pipeline: [{"$match": {"$or": [{"t": {"$lte": null}}, {"t": 0}], "a": 0}}, {"$group": {"_id": "$m"}}],
cursor: {},
}),
);