Files
mongo/jstests/core/query/explain/explain4.js
Lynne Wang 202381bce2 SERVER-103770 Add fcv_82 required to sharded explain tests (#34982)
GitOrigin-RevId: 6c3030fb3fca5f628e75889bbb7d6f21fad42a82
2025-04-14 14:37:09 +00:00

20 lines
436 B
JavaScript

// Test that limit is applied by explain.
// @tags: [
// assumes_read_concern_local,
// requires_fcv_82,
// ]
let t = db.jstests_explain4;
t.drop();
t.createIndex({a: 1});
for (let i = 0; i < 10; ++i) {
t.save({a: i, b: 0});
}
let explain = t.find({a: {$gte: 0}, b: 0}).sort({a: 1}).hint({a: 1}).limit(5).explain(true);
// Five results are expected, matching the limit spec.
assert.eq(5, explain.executionStats.nReturned);