Info
Accidentally encountered this while connecting to my Atlas cluster. Essentially if the supplied URI is malformed, the shell fails with the exception: No digits error which does not really articulate what the problem is exactly:
$ mongo "mongodb+srv:/cluster2.fu4ty.mongodb.net/"
MongoDB shell version v4.4.0
exception: No digits
exiting with code 1
$ mongo "mongo+srv://cluster2.fu4ty.mongodb.net/"
MongoDB shell version v4.4.0
exception: No digits
exiting with code 1
Top User Comments
mark@rideamigos.com commented on Tue, 6 Jun 2023 13:37:02 +0000:
This error can also occur with a valid query string that is surrounded by smart quotes instead of regular quotes. It took us awhile to spot that some app had converted the quotes. 🤦🏼♂️ It would be great if that condition could be flagged, with an error like "It looks like you used smart quotes. Use regular single or double quotes for your connection string".
thomas.schubert commented on Thu, 8 Oct 2020 17:26:05 +0000:
Thanks for investigating!
dmitry.ryabtsev commented on Wed, 7 Oct 2020 00:42:08 +0000:
mongosh is producing the correct (meaningful) error:
$./mongosh "mongodb+srv:/cluster2.fu4ty.mongodb.net/"
Current sessionID: 008127eab3b31504545f10ae
Connecting to:
mongodb+srv:/cluster2.fu4ty.mongodb.net/
MongoParseError: Invalid connection string
I guess we can close this one off.
thomas.schubert commented on Mon, 5 Oct 2020 17:11:37 +0000:
Is this a problem with the new shell, mongosh?
If it is, I would suggest moving this ticket for team to work on. If not, I think we should close this ticket as we're focusing on improving mongosh for end-user behavior.