[SERVER-51338] Mongo shell v4.4 reports a non-specific exception when a malformed URI is supplied Created: 03/Oct/20  Updated: 06/Jun/23  Resolved: 08/Oct/20

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 4.4.0
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Dmitry Ryabtsev Assignee: Backlog - Triage Team
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Triage
Operating System: ALL
Participants:

 Description   

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



 Comments   
Comment by Mark Stosberg [ 06/Jun/23 ]

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". 

Comment by Kelsey Schubert [ 08/Oct/20 ]

Thanks for investigating!

Comment by Dmitry Ryabtsev [ 07/Oct/20 ]

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.

Comment by Kelsey Schubert [ 05/Oct/20 ]

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.

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