MongoError: topology was destroyed sailsjs

匿名 (未验证) 提交于 2019-12-03 01:23:02

问题:

When I try to create this error shows up:

Error (E_UNKNOWN) :: Encountered an unexpected error MongoError: topology was destroyed at Server.insert (/Users/oscargallon/Documents/developer/sails/reyesmagoswebpae/node_modules/sails-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:797:49)

here's my model

module.exports = {      attributes: {         name: {             type: 'string',             required: true         },         email: {             type: 'String',             required: true         },         description: {             type: 'string',             required: true         },         phonenumber: {             type: 'string',             required: true         },         mobile: {             type: 'string',             required: true         }     } }; 

回答1:

I also encountered this same problem today - i changed the sails-mongo version from "sails-mongo": "^0.10.7" to "sails-mongo": "^0.10.6" in package.json in sails and ran $ sudo npm install then sails lift it worked fine i think there is some error in npm



回答2:

Sails-mongo v0.10.7 introduced a breaking change and doesn't support mongo

Simultaneously v0.11 has been released which is compatible with mongo >= 2.6.

For those using mongo do not update to 0.11.x.

UPDATE: some users reported problems with Mongo 3.0 and using v0.10.8 seems to have fixed the issue for them: more details.

UPDATE 2: The issue with v0.10.7 and v0.11.0-1 has been traced to inappropriate connection configurations (PR #277). This can be fixed locally by adjusting the connection config (sails/config/connections.js file for sails users):

devMongodbServer: { // connection name     port: 27017,     database: 'dev-mongodb-server',     poolSize: 5,     socketOptions: {         noDelay: true,         connectTimeoutMS: 0,         socketTimeoutMS: 0     } } 

v0.11.2 will be released with this connection config as default.

More details on https://github.com/balderdashy/sails-mongo/issues/266



回答3:

As mentioned by Anandapriyan, it caused by 0.10.7 sail-mongo. The solution doesn't work for me but inspired me. I re-install sail-mongo with a elder build. and it works.

sudo npm install sails-mongo@0.10.6 --save 

I've tried 0.10.4 but I got another error. So just user 0.10.6

error: A hook (`orm`) failed to load! 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!