What is a TransientTransactionError in Mongoose (or MongoDB)?

前端 未结 16 1794
庸人自扰
庸人自扰 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:04

    I had this problem when trying to connect my Heroku app to a MongoDB Atlas database.

    If you do a on you terminal

    heroku logs --tail

    You might see

    ERROR: { MongoNetworkError: 
    connection 4 to cluster0-shard-40-01-qnwp8.mongodb.net:27017 closed
    name: 'MongoNetworkError',
    errorLabels: [ 'TransientTransactionError' ],
    [Symbol(mongoErrorContextSymbol)]: {} }`
    

    After whitelisting the server connection on MongoDB Atlas, the database connection error was resolved.

提交回复
热议问题