Skip to content

Commit 5a31cda

Browse files
committed
Test comma in db name
JAVA-4196
1 parent e1d4351 commit 5a31cda

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"uri": "mongodb+srv://test1.test.build.10gen.cc/some%2Cdb?replicaSet=repl0",
3+
"seeds": [
4+
"localhost.test.build.10gen.cc:27017",
5+
"localhost.test.build.10gen.cc:27018"
6+
],
7+
"hosts": [
8+
"localhost:27017",
9+
"localhost:27018",
10+
"localhost:27019"
11+
],
12+
"options": {
13+
"replicaSet": "repl0",
14+
"ssl": true
15+
},
16+
"parsed_options": {
17+
"defaultDatabase": "some,db"
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"uri": "mongodb+srv://test1.test.build.10gen.cc/some,db?replicaSet=repl0",
3+
"seeds": [
4+
"localhost.test.build.10gen.cc:27017",
5+
"localhost.test.build.10gen.cc:27018"
6+
],
7+
"hosts": [
8+
"localhost:27017",
9+
"localhost:27018",
10+
"localhost:27019"
11+
],
12+
"options": {
13+
"replicaSet": "repl0",
14+
"ssl": true
15+
},
16+
"parsed_options": {
17+
"defaultDatabase": "some,db"
18+
}
19+
}

driver-core/src/test/unit/com/mongodb/ConnectionStringSpecification.groovy

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class ConnectionStringSpecification extends Specification {
6464
new ConnectionString('mongodb://localhost/' +
6565
'test.my.coll') | 1 | ['localhost'] | 'test' | 'my.coll' | null | null
6666
new ConnectionString('mongodb://foo/bar.goo') | 1 | ['foo'] | 'bar' | 'goo' | null | null
67+
new ConnectionString('mongodb://foo/s,db') | 1 | ['foo'] | 's,db'| null | null | null
68+
new ConnectionString('mongodb://foo/s%2Cdb') | 1 | ['foo'] | 's,db'| null | null | null
6769
new ConnectionString('mongodb://user:pass@' +
6870
'host/bar') | 1 | ['host'] | 'bar' | null | 'user' | 'pass' as char[]
6971
new ConnectionString('mongodb://user:pass@' +

driver-sync/src/test/functional/com/mongodb/client/InitialDnsSeedlistDiscoveryTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ private void assertParsedOptions(final ConnectionString connectionString) {
281281
for (Map.Entry<String, BsonValue> entry : parsedOptions.entrySet()) {
282282
switch (entry.getKey()) {
283283
case "db":
284+
case "defaultDatabase":
284285
assertEquals(entry.getValue().asString().getValue(), connectionString.getDatabase());
285286
break;
286287
case "user":

0 commit comments

Comments
 (0)