-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Environment:MongoDB shell version v4.4.13
Build Info: {
"version": "4.4.13",
"gitVersion": "df25c71b8674a78e17468f48bcda5285decb9246",
"openSSLVersion": "OpenSSL 1.0.1e-fips 11 Feb 2013",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "rhel70",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}MongoDB shell version v4.4.13 Build Info: { "version": "4.4.13", "gitVersion": "df25c71b8674a78e17468f48bcda5285decb9246", "openSSLVersion": "OpenSSL 1.0.1e-fips 11 Feb 2013", "modules": [], "allocator": "tcmalloc", "environment": { "distmod": "rhel70", "distarch": "x86_64", "target_arch": "x86_64" } }
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
Problem Statement/Rationale
running follow command
```
mongoexport --host dbhost --port 27017 --db=mms-service --collection=document --type=csv --fields=_id --query='{}' --limit 10 --out exported.csv -u=user.name --authenticationDatabase admin
```
but i get an error
```
could not connect to server: connection() error occured during connection handshake: handshake failure: username must contain a '.' separated database.user pair
```
what is the meaning of the error, it is the issue of the username, a dot in the username?
i also try to add quote to the username: "user.name", 'user.name', same error
Steps to Reproduce
use mongo/mongoexport to connect to the db
Expected Results
login the db successfully
Actual Results
login failed
Additional Notes
1, also try mongo command, same error
```
mongo "mongodb://user.name:password@db-host:27017/?authSource=admin"
mongo --host dbhost --port 27017 -u user.name -p password --authenticationDatabase admin
```
error message:
```
MongoDB shell version v4.4.13
connecting to: mongodb://dbhost:27017/authSource=admin&compressors=disabled&gssapiServiceName=mongodb
Error: username must contain a '.' separated database.user pair :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
```
2, connect the db without auth, then auth by db.auth(), in this way, i can login into the db
```
mongo --host dbhost -p 27017
db.auth("user.name", "password") – the quote required
user dbname
show collections
```
it show the collections.