Reputation: 15252
recently AWS implemented compatibility with MongoDB version 3.6 via DocumentDB.
Document DB requires a certificate that can be downloaded at:
https://s3-us-gov-west-1.amazonaws.com/rds-downloads/rds-GovCloud-Root-CA-2017.pem
Using a configuration file similar to:
https://github.com/mongodb/mongoid/blob/master/lib/rails/generators/mongoid/config/templates/mongoid.yml
I would like to know if there is a way to set compatibility with 3.6 in mongoid gem or if there is a specific version that ensures that version 3.6 is used?
Thank you
Upvotes: 5
Views: 1969
Reputation: 11
as of 2022,
aws provided uri
with protocol(mongodb
://) and query seems not working with mongoid..?
( as I got error below
Mongoid::Errors::MixedClientConfiguration: message: Both uri and standard configuration options defined for client: 'default'.
then, I modified
config/mongoid.yml
working example should be like this:
development:
clients:
default:
database: your_db
hosts:
- xxx.ap-northeast-1.docdb.amazonaws.com:27017
options:
user: mongo_user
password: password
ssl: true
ssl_verify: false
ssl_cert: path/to/rds-combined-ca-bundle.pem
reference:
Upvotes: 0
Reputation: 15252
Sample Working Configuration
production:
clients:
default:
uri: "mongodb://user:pass@db_end_point:27017/db_name?ssl=true&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false"
app_name: AppName
options:
ssl_ca_cert: "./config/rds-combined-ca-bundle.pem"
development:
clients:
default:
uri: "mongodb://user:pass@db_end_point:27017/db_name?ssl=true&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false"
app_name: AppName
options:
ssl_ca_cert: "./config/rds-combined-ca-bundle.pem"
test:
clients:
default:
uri: "mongodb://user:pass@db_end_point:27017/db_name?ssl=true&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false"
app_name: AppName
options:
ssl_ca_cert: "./config/rds-combined-ca-bundle.pem"
Upvotes: 0
Reputation: 227
First, you may need to download the RDS combined bundle as opposed to the rds-GovCloud-Root-CA-2017.pem
. Link: https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
Try this as your yaml file:
development:
clients:
default:
uri: mongodb://myuser:mypassword@<your_cluster_endpoint>:<cluster_port>/test?ssl=true
options:
ssl_ca_cert: /path/to/rds-combined-ca-bundle.pem
Upvotes: 2
Reputation: 14520
First, it is important to note that DocumentDB implements only partial compatibility with "MongoDB 3.6" as Amazon advertises. You can read more about some of the incompatibilities here: https://www.mongodb.com/blog/post/documents-are-everywhere
Mongoid works, and is tested, with the actual MongoDB 3.6 server. No special configuration is needed.
Using Mongoid with DocumentDB may work or may expose incompatibilities/omissions in Amazon's document database, depending on exact operations attempted.
Upvotes: 3