I have server.js
and db.js
The db.js
file interacts with my database using Mongoose and I use server.js
to call functions
I encountered this error when running the populatedb.js
script in the MDN tutorial for Express/NodeJS.
The script was looking for a db connection starting with mongodb://
, however my connection string from mongo started with mongodb+srv://
.
I edited the script to check for this syntax instead, which resolved the error.
I hope this helps someone.
You can read about the error online but the solution for this problem is: go to you MongoDB atlas and add your IP address.
Go to: main page > security section > network access > add IP
This problem is basically when the architecture do not know your own IP address.
Also, copy-paste directly to google to get straight forward solution.
If you are using MongoDB Atlas. You need to Whitelist your IP address on the Atlas Console in the security settings.
Make sure the server didn't ran out of storage space.
In my case none of the suggested answers helped. I was pulling out my hair until I've noticed that the server simply ran out of storage space. Clearing up a few megabytes of storage solved the error immediately.
The TransientTransactionError
actually makes sense in this scenario due to its nature of being a temporary error that could be resolved upon an explicit retry - though it did took me a while to figure out it had to do with a storage issue.