[COMPASS-4420] Special Character in Database Name Doesn't Work as Expected in mongosh Created: 18/Sep/20  Updated: 18/Sep/20  Resolved: 18/Sep/20

Status: Closed
Project: Compass
Component/s: Compass
Affects Version/s: 1.23.0
Fix Version/s: No version

Type: Bug Priority: Minor - P4
Reporter: Felicia Hsieh Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2020-09-17 at 7.59.07 PM.png     PNG File Screen Shot 2020-09-17 at 8.14.48 PM.png     PNG File image-2020-09-18-09-48-21-549.png    
Documentation Changes: Not Needed

 Description   

This is for Compass 1.23.0-beta.2 but doesn't exist in the Jira field tag.

In mongosh

> use %3Cscript%3Ealert(1)%3C%2Fscript%3E
> db.asdf.insertOne("hello":"test")

generates an error, but the "%" character is allowed.

https://docs.mongodb.com/manual/reference/limits/#restrictions-on-db-names

In Compass UI, creating the database and adding a document is successful. The behavior is inconsistent.

Related to https://jira.mongodb.org/browse/CLOUDP-70233



 Comments   
Comment by Massimiliano Marcon [ 18/Sep/20 ]

felicia.hsieh you are using the wrong syntax for insertOne. insertOne takes an object as its first argument:

Generated at Wed Feb 07 22:36:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.