Description
Versions/Environment
- What version of Rust are you using?
1.76.0
- What operating system are you using?
Ubuntu 20.04.6 LTS
- What versions of the driver and its dependencies are you using?
[email protected]
,[email protected]
- What version of MongoDB are you using?
5.0.0
- What is your MongoDB topology?
Amazon DocumentDB
Bug description
In the case of AuthMechanism::MongoDbAws
, the implementation of default_source<'a>(&'a self, uri_db: Option<&'a str>) -> &'a str[]
in client/auth.rs returns $external
, which is used to overwrite the target_db
field of the hello command in handshake.rs. However, running hello
and isMaster
is not supported on $external
in Amazon DocumentDB deployments:
"ok": 0,
"code": 73,
"errmsg": "Command isMaster not supported on $external database."
Expected behavior
I expect to be able to handshake and connect to Amazon DocumentDB clusters by using a connection string of the form mongodb://<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&authMechanism=MONGODB-AWS
.
To Reproduce
Steps to reproduce the behavior:
- Deploy an Amazon DocumentDB cluster.
- Create the necessary IAM role and instance profile.
- Associate an EC2 instance with the instance profile created in
2.
. - Login to the EC2 instance using SSH.
- Use
mongo-rust-driver
to connect to the cluster created in1.
with a connection string of the formmongodb://<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&authMechanism=MONGODB-AWS
. - Bug occurs.
Note
I am not entirely certain whether this is actually a bug in mongo-rust-driver
, or a configuration issue on the part of AWS. I was able to connect to my cluster by making the hello command in the handshake target the admin
database.