{
"tests": [
{
"auth": {
"db": null,
"password": "foo",
"username": "alice"
},
"description": "User info for single IPv4 host without database",
"hosts": [
{
"host": "127.0.0.1",
"port": null,
"type": "ipv4"
}
],
"options": null,
"uri": "mongodb://alice:foo@127.0.0.1",
"valid": true,
"warning": false
},
{
"auth": {
"db": "test",
"password": "foo",
"username": "alice"
},
"description": "User info for single IPv4 host with database",
"hosts": [
{
"host": "127.0.0.1",
"port": null,
"type": "ipv4"
}
],
"options": null,
"uri": "mongodb://alice:foo@127.0.0.1/test",
"valid": true,
"warning": false
},
{
"auth": {
"db": "t\u0000est",
"password": "f\u0000oo",
"username": "a\u0000lice"
},
"description": "User info for single IPv4 host with database (escaped null bytes)",
"hosts": [
{
"host": "127.0.0.1",
"port": null,
"type": "ipv4"
}
],
"options": null,
"uri": "mongodb://a%00lice:f%00oo@127.0.0.1/t%00est",
"valid": true,
"warning": false
},
{
"auth": {
"db": null,
"password": "bar",
"username": "bob"
},
"description": "User info for single IP literal host without database",
"hosts": [
{
"host": "::1",
"port": 27018,
"type": "ip_literal"
}
],
"options": null,
"uri": "mongodb://bob:bar@[::1]:27018",
"valid": true,
"warning": false
},
{
"auth": {
"db": "admin",
"password": "bar",
"username": "bob"
},
"description": "User info for single IP literal host with database",
"hosts": [
{
"host": "::1",
"port": 27018,
"type": "ip_literal"
}
],
"options": null,
"uri": "mongodb://bob:bar@[::1]:27018/admin",
"valid": true,
"warning": false
},
{
"auth": {
"db": null,
"password": "baz",
"username": "eve"
},
"description": "User info for single hostname without database",
"hosts": [
{
"host": "example.com",
"port": null,
"type": "hostname"
}
],
"options": null,
"uri": "mongodb://eve:baz@example.com",
"valid": true,
"warning": false
},
{
"auth": {
"db": "db2",
"password": "baz",
"username": "eve"
},
"description": "User info for single hostname with database",
"hosts": [
{
"host": "example.com",
"port": null,
"type": "hostname"
}
],
"options": null,
"uri": "mongodb://eve:baz@example.com/db2",
"valid": true,
"warning": false
},
{
"auth": {
"db": null,
"password": "secret",
"username": "alice"
},
"description": "User info for multiple hosts without database",
"hosts": [
{
"host": "127.0.0.1",
"port": null,
"type": "ipv4"
},
{
"host": "example.com",
"port": 27018,
"type": "hostname"
}
],
"options": null,
"uri": "mongodb://alice:secret@127.0.0.1,example.com:27018",
"valid": true,
"warning": false
},
{
"auth": {
"db": "admin",
"password": "secret",
"username": "alice"
},
"description": "User info for multiple hosts with database",
"hosts": [
{
"host": "example.com",
"port": null,
"type": "hostname"
},
{
"host": "::1",
"port": 27019,
"type": "ip_literal"
}
],
"options": null,
"uri": "mongodb://alice:secret@example.com,[::1]:27019/admin",
"valid": true,
"warning": false
},
{
"auth": {
"db": null,
"password": null,
"username": "alice"
},
"description": "Username without password",
"hosts": [
{
"host": "127.0.0.1",
"port": null,
"type": "ipv4"
}
],
"options": null,
"uri": "mongodb://alice@127.0.0.1",
"valid": true,
"warning": false
},
{
"auth": {
"db": null,
"password": "",
"username": "alice"
},
"description": "Username with empty password",
"hosts": [
{
"host": "127.0.0.1",
"port": null,
"type": "ipv4"
}
],
"options": null,
"uri": "mongodb://alice:@127.0.0.1",
"valid": true,
"warning": false
},
{
"auth": {
"db": "my=db",
"password": null,
"username": "@l:ce"
},
"description": "Escaped username and database without password",
"hosts": [
{
"host": "example.com",
"port": null,
"type": "hostname"
}
],
"options": null,
"uri": "mongodb://%40l%3Ace@example.com/my%3Ddb",
"valid": true,
"warning": false
},
{
"auth": {
"db": "admin?",
"password": "f:zzb@zz",
"username": "$am"
},
"description": "Escaped user info and database (MONGODB-CR)",
"hosts": [
{
"host": "127.0.0.1",
"port": null,
"type": "ipv4"
}
],
"options": {
"authmechanism": "MONGODB-CR"
},
"uri": "mongodb://%24am:f%3Azzb%40zz@127.0.0.1/admin%3F?authMechanism=MONGODB-CR",
"valid": true,
"warning": false
},
{
"auth": {
"db": null,
"password": null,
"username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry"
},
"description": "Escaped username (MONGODB-X509)",
"hosts": [
{
"host": "localhost",
"port": null,
"type": "hostname"
}
],
"options": {
"authmechanism": "MONGODB-X509"
},
"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509",
"valid": true,
"warning": false
},
{
"auth": {
"db": null,
"password": "secret",
"username": "user@EXAMPLE.COM"
},
"description": "Escaped username (GSSAPI)",
"hosts": [
{
"host": "localhost",
"port": null,
"type": "hostname"
}
],
"options": {
"authmechanism": "GSSAPI",
"authmechanismproperties": {
"CANONICALIZE_HOST_NAME": true,
"SERVICE_NAME": "other"
}
},
"uri": "mongodb://user%40EXAMPLE.COM:secret@localhost/?authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true&authMechanism=GSSAPI",
"valid": true,
"warning": false
},
{
"auth": {
"db": "admin",
"password": "secret",
"username": "alice"
},
"description": "At-signs in options aren't part of the userinfo",
"hosts": [
{
"host": "example.com",
"port": null,
"type": "hostname"
}
],
"options": {
"replicaset": "my@replicaset"
},
"uri": "mongodb://alice:secret@example.com/admin?replicaset=my@replicaset",
"valid": true,
"warning": false
}
]
}