[SERVER-29921] Mongo connection uri doesn't support @ character in database name Created: 29/Jun/17  Updated: 30/Oct/23  Resolved: 21/Sep/17

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: 3.4.11, 3.6.0-rc0

Type: Bug Priority: Major - P3
Reporter: Christian Assignee: Sara Golemon
Resolution: Fixed Votes: 0
Labels: neweng, platforms-interns-2017
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-33059 Shell no longer accepts legacy connec... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Backport Requested:
v3.4
Steps To Reproduce:

christian@katt-lnvo:~$ mongo mongodb://10.123.176.52/demo@saas
MongoDB shell version v3.4.5
connecting to: mongodb://10.123.176.52/demo@saas
2017-06-29T10:40:56.722-0300 I NETWORK  [thread1] getaddrinfo("saas") failed: Name or service not known
2017-06-29T10:40:56.722-0300 E QUERY    [thread1] Error: couldn't initialize connection to host saas, address is invalid :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

I try to scape the character but It doesn't work

christian@katt-lnvo:~$ mongo mongodb://10.123.176.52/demo%40saas
MongoDB shell version v3.4.5
connecting to: mongodb://10.123.176.52/demo%40saas
MongoDB server version: 3.4.4
rs1:PRIMARY> db
demo%40saas
rs1:PRIMARY> 

Sprint: Platforms 2017-07-31, Platforms 2017-08-21, Platforms 2017-09-11, Platforms 2017-10-02
Participants:

 Description   

"@" is a valid caracter for database names but it is not supported in shell connection uri.



 Comments   
Comment by Githook User [ 27/Nov/17 ]

Author:

{'name': 'Sara Golemon', 'username': 'sgolemon', 'email': 'sara.golemon@mongodb.com'}

Message: SERVER-29921 rewrite URI parser

(cherry picked from commit f3bf7e7920a51df7100238a55c304ed7cd3aed1f)
Branch: v3.4
https://github.com/mongodb/mongo/commit/80652b9b86a78971c06fa05497cb359930ff4661

Comment by Sara Golemon [ 21/Sep/17 ]

This change includes a complete rewrite of the mongodb:// uri parser. Every effort has been made to conform to spec and support documented formats, however given that the previous parser was loose in how it dealt with malformed connection strings, it possible that this new parser will reject connection strings which previously worked, despite being slightly malformed.

Comment by Githook User [ 21/Sep/17 ]

Author:

{'email': 'sara.golemon@mongodb.com', 'name': 'Sara Golemon', 'username': 'sgolemon'}

Message: SERVER-29921 rewrite URI parser
Branch: master
https://github.com/mongodb/mongo/commit/f3bf7e7920a51df7100238a55c304ed7cd3aed1f

Comment by Tyler Kaye [ 10/Aug/17 ]

Author:

{'username': 'tkaye407', 'email': 'tyler.kaye@mongodb.com', 'name': 'Tyler Kaye'}

Message: SERVER-29923 Re-write the Mongo Server's URI parser and Testing Suite
Branch: master
https://github.com/mongodb/mongo/commit/880e3c102363611ef09b451737276c0ad9400d11

Comment by Tyler Kaye [ 10/Jul/17 ]

The regex has been completely removed and the URI parser is now up to the standards of the spec seen here (https://github.com/mongodb/specifications/blob/master/source/connection-string/connection-string-spec.rst#reference-implementation)

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