What is a TransientTransactionError in Mongoose (or MongoDB)?

前端 未结 16 1726
庸人自扰
庸人自扰 2020-11-27 07:36

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

相关标签:
16条回答
  • 2020-11-27 08:11

    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.

    0 讨论(0)
  • 2020-11-27 08:15

    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.

    0 讨论(0)
  • 2020-11-27 08:16

    If you are using MongoDB Atlas. You need to Whitelist your IP address on the Atlas Console in the security settings.

    0 讨论(0)
  • 2020-11-27 08:17

    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.

    0 讨论(0)
提交回复
热议问题