errorLabels:Linux上的['TransientTransactionError'] for Mongo v4.0.9

时间:2019-05-31 15:51:48

标签: node.js mongodb

Mongo已启动并在我的Linux VM播放器设置上运行。我能够使用mongo shell连接到我的收藏集并查找数据等。 Mongo状态也显示为绿色。

MongoDB shell version v4.0.9
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb

但是从我的节点应用程序中,我试图使用连接字符串mongodb://127.0.0.1:27017连接到此mongo,并在尝试通过代码访问时遇到异常。

Unable to connect to MongoDB:  { MongoNetworkError: failed to connect to server [127.0.0.1:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]
    at Pool.<anonymous> (/node_modules/mongodb-core/lib/topologies/server.js:564:11)
    at emitOne (events.js:116:13)
    at Pool.emit (events.js:211:7)
    at Connection.<anonymous> (/node_modules/mongodb-core/lib/connection/pool.js:317:12)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at Connection.emit (events.js:214:7)
    at Socket.<anonymous> (/node_modules/mongodb-core/lib/connection/connection.js:246:50)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
  name: 'MongoNetworkError',
  errorLabels: [ 'TransientTransactionError' ],
  [Symbol(mongoErrorContextSymbol)]: {} }
/node_modules/mongodb/lib/operations/mongo_client_ops.js:466
      throw err;

在Windows计算机上进行类似的mongo设置没问题。

0 个答案:

没有答案