Do you know a Scala driver to MongoDB, which is also compatible to Amazon DocumentDB? In theory they all should be compatible, I am interested what works in practice. In particular, I plan to use reactivemongo
.
Asked
Active
Viewed 444 times
2

Mikhail Golubtsov
- 6,285
- 3
- 29
- 36
-
1If DocumentDB is as compatible as AWS claim, any MongoDB driver would work – cchantep Jul 03 '19 at 17:42
-
Planning to migrate to DocumentDB, but seems reactivemongo driver is not compatible, need to check for any workarounds – binary Jul 16 '19 at 03:59
-
@binary what makes you think that? – cchantep Jul 16 '19 at 08:16
-
1@cchantep I myself couldn't find a way to connect to DocumentDB using reactivemongo – Mikhail Golubtsov Jul 16 '19 at 08:18
-
DocumentDB claims to be compatible with MongoDB, so it should provide connection options required, such as host, port, db name, auth source, auth algo, user name, password, whether to use SSL, ... – cchantep Jul 16 '19 at 08:23
-
That's in theory, but DocumentDB doesn't support all connection options of Mongodb, and reactivemongo doesn't support all the options too, that's why the issues. If you know how to make it work, I'd be glad to know. – Mikhail Golubtsov Jul 16 '19 at 08:56
-
First DocumentDB can [only be used from AWS VPN](https://docs.aws.amazon.com/documentdb/latest/developerguide/connect-from-outside-a-vpc.html), then according MongoDB themselves, [DocumentDB is far from being 100% compatible](https://www.mongodb.com/atlas-vs-amazon-documentdb), finally you don't any error/detail/stack trace. – cchantep Jul 16 '19 at 14:34
-
@cchantep Done a POC to connect using both reactivemongo (http://reactivemongo.org/) and mongo-scala-driver (https://mongodb.github.io/mongo-scala-driver/) to DocumentDB and able to connect only using mongo-scala-driver – binary Jul 17 '19 at 04:03
-
AWS DocumentDB is using [RDS certificate for SSL](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html), which either require to generate the corresponding JVM Keystore (not provided as-is by AWS) to set `keyStore` for connection, or use `sslAllowsInvalidCert=true` to skip certification validation on SSL handshake. – cchantep Jul 17 '19 at 21:39
2 Answers
1
https://mongodb.github.io/mongo-scala-driver/ is compatible with Amazon DocumentDB.

Abhilash
- 377
- 1
- 3
- 13
-
The question should rather be how DocumentDB is compatible with MongoDB (up to which version/features), then choose appropriate lib/driver – cchantep Jul 16 '19 at 08:18
-
Also see: http://reactivemongo.org/releases/0.1x/documentation/tutorial/amazon-documentdb.html – Joseph Idziorek Jul 19 '19 at 03:42
1
Main point is to properly use the RDS certificate (cannot be tested locally w/o tunnel), as indicated in the documentation.
mongodb.uri = "mongodb://${USER}:${PASSWORD}@${DOCDB_CLUSTER}${AWS_REGION}.docdb.amazonaws.com:27017/${DB_NAME}?ssl=true&keyStore=file:///path/on/local/fs/to/rds-ca-2015-root.jks&keyStorePassword=${KEYSTORE_PASS}&keyStoreType=JKS"

cchantep
- 9,118
- 3
- 30
- 41