[SERVER-66047] Parameter 'limit' is not supported for exhaust queries in Mongo Shell Created: 28/Apr/22  Updated: 29/Oct/23  Resolved: 03/Jun/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 6.1.0-rc0
Fix Version/s: 6.1.0-rc0

Type: Bug Priority: Minor - P4
Reporter: Mindaugas Malinauskas Assignee: David Storch
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-65955 Shell's special query path for exhaus... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

var coll = db.exhaustColl;
coll.drop();
 
// Include a long string in each document so that the documents are a bit bigger than 16KB.
const strSize = 16 * 1024;
// The docs are ~16KB and each getMore response is 16MB. Therefore, a full getMore batch will
// contain about 1000 documents. Since the initial find response is limited to only 101 documents,
// by inserting 3000 we ensure that three subsequent getMore replies are required. Roughly speaking,
// the initial reply will consist of the first 100, the first getMore reply 1000 more, then another
// 1000, and then the remaining 900.
const numDocs = 3000;
 
const str = "A".repeat(strSize);
 
let bulk = coll.initializeUnorderedBulkOp();
for (let i = 0; i < numDocs; ++i) {
    bulk.insert({key: str});
}
assert.commandWorked(bulk.execute());
 
assert.eq(numDocs, coll.find().limit(10000).addOption(DBQuery.Option.exhaust).itcount());

Result:

Error: Cannot have limit for exhaust query

Sprint: QE 2022-05-16, QE 2022-05-30, QE 2022-06-13
Participants:
Linked BF Score: 15

 Description   

Parameter 'limit' is not supported for exhaust queries in Mongo Shell. Negative 'limit' parameter values should be support to keep parity to non-exhaust queries.



 Comments   
Comment by Githook User [ 03/Jun/22 ]

Author:

{'name': 'David Storch', 'email': 'david.storch@mongodb.com', 'username': 'dstorch'}

Message: SERVER-66047 Fix the shell's exhaust impl to work with limit
Branch: master
https://github.com/mongodb/mongo/commit/7f8bbabce8765ad9055745963241fe9d7ae2c0a1

Generated at Thu Feb 08 06:04:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.