Can I use AWS DocumentDB instead of MongoDB? #652
-
I want to link AWS DocumentDB. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 9 replies
-
Hey @prove-ability, this error indicates that you are not passing the pem file contents into the Mongo options. You will need to have your .pem file locally and pass the contents into const caContent = fs.readFileSync('/path/to/rds-combined-ca-bundle.pem');
payload.init({
// ..
mongoOptions: {
sslCA: caContent,
},
}); Let me know if that gets you any further. Here are some links to SO issues that may be useful as well: link, link |
Beta Was this translation helpful? Give feedback.
-
@prove-ability Have you gotten the DocumentDB to work? |
Beta Was this translation helpful? Give feedback.
-
Hello @jmikrut , i tried set Do you have Ideas why, |
Beta Was this translation helpful? Give feedback.
-
I'm going to chime in with how I managed to connect to AWS DocumentDB locally. As stated in the AWS docs about "Connecting to an Amazon DocumentDB Cluster from Outside an Amazon VPC", you need to use SSH tunneling (port forwarding). Here's the command that creates a tunnel: ssh -i /Users/path/to/ssh-private-key -L 27017:your-cluster.cluster-id.eu-central-1.docdb.amazonaws.com:27017 [email protected] -N Then, your
Couple of things to note:
At this point, you should have Before using DocumentDB, I was using Atlas, and the only change in my code I had to make (besides the MongoDB connection string in await payload.init({
secret: process.env.PAYLOAD_SECRET,
mongoURL: process.env.MONGODB_URI,
express: app,
+ mongoOptions: {
+ useFacet: false,
+ },
}); |
Beta Was this translation helpful? Give feedback.
-
Hello. I was able to connect to DocumentDb with following config Does anyone know how to fix this issue? P.S. I have my own custom endpoint that is using payload.db. When I use .sort() the query stops working and showing the same issue. But if removed it works as expected. |
Beta Was this translation helpful? Give feedback.
Hey @prove-ability, this error indicates that you are not passing the pem file contents into the Mongo options. You will need to have your .pem file locally and pass the contents into
payload.init
undermongoOptions
. Here is an (untested) example:Let me know if that gets you any further.
Here are some links to SO issues that may be useful as well: link, link