-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Environment:OS:
node.js / npm versions:
Additional info:
-
2
-
Not Needed
-
Developer Tools
Problem Statement/Rationale
When users run something like:
test> response = db.test.dropIndex({"_id": 1}); MongoServerError: cannot drop _id index test> console.info(response); ReferenceError: response is not defined test> response = db.test.dropIndex({"a": 1}); MongoshInternalError: can't find index with key: { a: 1 } test> console.info(response); { ok: 0, errmsg: "can't find index with key: { a: 1 }", code: 27, codeName: 'IndexNotFound' }
mongosh seems to throw the error here instead of the dropIndex request going to the server. Hence `response` variable doesn't end up being set.
Steps to Reproduce
Run a similar snippet to above in mongosh
Expected Results
mongosh should throw an exception when dropping an index fails regardless of the exact index.
Actual Results
mongosh returns an error-like object rather than throwing an exception.
Additional Notes
Slack convo here: https://mongodb.slack.com/archives/CUHC9R8J0/p1695675347231129