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
}
}
};
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
Sails-mongo v0.10.7 introduced a breaking change and doesn't support mongo <= 2.4. The breaking change has been reverted and v0.10.8 was published restoring compatibility with mongo <= 2.4. Meanwhile v0.10.7 has been deprecated.
Simultaneously v0.11 has been released which is compatible with mongo >= 2.6.
For those using mongo <= 2.4 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
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!