[SERVER-73994] Remove un-intuitive command-builder API for .find() in the shell Created: 14/Feb/23  Updated: 23/Feb/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Charlie Swanson Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Participants:

 Description   

Now that the mongo shell is primarily a test driver, we should remove the foot-gun for testing engineers which expect

myCollection.find({example: "query"});

to actually issue a command to the database. Many tests do this and expect to see some side-effects like a log statement, profiler entry, etc.

Let's investigate our options for making it more obvious that your query is not doing anything, or harder to do unintentionally.



 Comments   
Comment by David Storch [ 23/Feb/23 ]

One consideration is that the API as currently designed allows you to write shell code like so:

let cursor = db.collection.find(<match>);
cursor = cursor.sort(<sort>);
cursor = cursor.limit(3);
// ... etc

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