Skip to content

Commit

Permalink
Test comma in db name
Browse files Browse the repository at this point in the history
  • Loading branch information
jyemin committed Feb 10, 2023
1 parent e1d4351 commit 5a31cda
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"uri": "mongodb+srv://test1.test.build.10gen.cc/some%2Cdb?replicaSet=repl0",
"seeds": [
"localhost.test.build.10gen.cc:27017",
"localhost.test.build.10gen.cc:27018"
],
"hosts": [
"localhost:27017",
"localhost:27018",
"localhost:27019"
],
"options": {
"replicaSet": "repl0",
"ssl": true
},
"parsed_options": {
"defaultDatabase": "some,db"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"uri": "mongodb+srv://test1.test.build.10gen.cc/some,db?replicaSet=repl0",
"seeds": [
"localhost.test.build.10gen.cc:27017",
"localhost.test.build.10gen.cc:27018"
],
"hosts": [
"localhost:27017",
"localhost:27018",
"localhost:27019"
],
"options": {
"replicaSet": "repl0",
"ssl": true
},
"parsed_options": {
"defaultDatabase": "some,db"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class ConnectionStringSpecification extends Specification {
new ConnectionString('mongodb://localhost/' +
'test.my.coll') | 1 | ['localhost'] | 'test' | 'my.coll' | null | null
new ConnectionString('mongodb://foo/bar.goo') | 1 | ['foo'] | 'bar' | 'goo' | null | null
new ConnectionString('mongodb://foo/s,db') | 1 | ['foo'] | 's,db'| null | null | null
new ConnectionString('mongodb://foo/s%2Cdb') | 1 | ['foo'] | 's,db'| null | null | null
new ConnectionString('mongodb://user:pass@' +
'host/bar') | 1 | ['host'] | 'bar' | null | 'user' | 'pass' as char[]
new ConnectionString('mongodb://user:pass@' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ private void assertParsedOptions(final ConnectionString connectionString) {
for (Map.Entry<String, BsonValue> entry : parsedOptions.entrySet()) {
switch (entry.getKey()) {
case "db":
case "defaultDatabase":
assertEquals(entry.getValue().asString().getValue(), connectionString.getDatabase());
break;
case "user":
Expand Down

0 comments on commit 5a31cda

Please sign in to comment.