Open sadeghianme opened 6 years ago
Hi @sadeghianme! It looks like you may have removed some required elements from the initial comment template, without which I can't verify that this post meets our contribution guidelines. To re-open this issue, please copy the template from here, paste it at the beginning of your initial comment, and follow the instructions in the text. Then post a new comment (e.g. "ok, fixed!") so that I know to go back and check.
Sorry to be a hassle, but following these instructions ensures that we can help you in the best way possible and keep the Sails project running smoothly.
*If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact inquiries@sailsjs.com
Instead of this - user.create({name: 'sample'}).exec((err, userCreated) => { res.ok('userCreated'); }) Try with User.create(...)
Also, one other thing - mongodb://127.0.0.1:27017/server - is the server db created ?
thank you Saravanan Periyasamy, that was a favor to me. the problem solved, but the request i send doesnt insert any record in User collection and also i cant insert record to others collection :( Also, one other thing - mongodb://127.0.0.1:27017/server - is the server db created ? yes i created.
Mr Saravanan Periyasamy, i thought it solved but after check database i detected the record didnt insert:((( may please guide me, thank you :)
On Mon, Jul 16, 2018 at 9:36 AM Saravanan Periyasamy < notifications@github.com> wrote:
Instead of this - user.create({name: 'sample'}).exec((err, userCreated) => { res.ok('userCreated'); }) Try with User.create(...)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/balderdashy/sails/issues/4474#issuecomment-405149946, or mute the thread https://github.com/notifications/unsubscribe-auth/AY_FilCyZF_ICvT6PZQ016dnhI6lsGN2ks5uHB9XgaJpZM4VQYrj .
I am not finding any logical error in the code that you have written, my hunch is this - there is some issue with the DB connection. Try connecting once with a username and password to the DB, the connection string would be http://user:password@localhost:27017/db_name.
hello sir
really thank you for replying
when i set the password as adapter: 'sails-mongo',
url: 'mongodb://Mehdi:4342152@localhost:27017/uni',
i get this error.
Error details: Error: Consistency violation: Attempting to tear down a
datastore (default
) which is not currently registered with this adapter.
and when i dont set password i can lift app but when send a request i get
an error as my collection is not defined :(((
i push my code on git hub and please check it , thank you
may please have your gmail?
On Tue, Jul 17, 2018 at 8:26 AM Saravanan Periyasamy < notifications@github.com> wrote:
I am not finding any logical error in the code that you have written, my hunch is this - there is some issue with the DB connection. Try connecting once with a username and password to the DB, the connection string would be http://user:password@localhost:27017/db_name.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/balderdashy/sails/issues/4474#issuecomment-405451854, or mute the thread https://github.com/notifications/unsubscribe-auth/AY_FinehsN1bY1ojVg4uJm98S3lOFwQ0ks5uHWBSgaJpZM4VQYrj .
the address of github project https://github.com/sadeghianme/test
On Fri, Jul 20, 2018 at 1:10 AM Me Sa sadeghian.me@gmail.com wrote:
hello sir really thank you for replying when i set the password as adapter: 'sails-mongo', url: 'mongodb://Mehdi:4342152@localhost:27017/uni', i get this error. Error details: Error: Consistency violation: Attempting to tear down a datastore (
default
) which is not currently registered with this adapter. and when i dont set password i can lift app but when send a request i get an error as my collection is not defined :((( i push my code on git hub and please check it , thank youmay please have your gmail?
On Tue, Jul 17, 2018 at 8:26 AM Saravanan Periyasamy < notifications@github.com> wrote:
I am not finding any logical error in the code that you have written, my hunch is this - there is some issue with the DB connection. Try connecting once with a username and password to the DB, the connection string would be http://user:password@localhost:27017/db_name.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/balderdashy/sails/issues/4474#issuecomment-405451854, or mute the thread https://github.com/notifications/unsubscribe-auth/AY_FinehsN1bY1ojVg4uJm98S3lOFwQ0ks5uHWBSgaJpZM4VQYrj .
@sadeghianme - have you attempted to reproduce this issue with the latest Sails v1.1.0 and the latest sails-mongo v1.0.1?
hello I have a problem with new version of sails to connect to Sails-mongo. can you help me please?
Sails version: 1.0.2 Node version: 8.10 .0 NPM version: 5.6.0 DB adapter name: serve DB adapter version: N/A Operating system: win 10
datastore.js: module.exports.datastores = { default: { adapter: 'sails-mongo', url: 'mongodb://127.0.0.1:27017/server' } }
module.exports.models = { migrate: 'alter',
attributes: { createdAt: { type: 'number', autoCreatedAt: true, }, updatedAt: { type: 'number', autoUpdatedAt: true, }, id: { type: 'string', columnName: '_id', required: true }, },
dataEncryptionKeys: { default: '3X6yTfIErxEHDahmUxEdiRFg8rR8eU0/H8Z2AiGnNmU=' },
cascadeOnDestroy: true };
user.js module.exports = { attributes: { name: { type: 'string' } }
userController.js module.exports = { createUser: (req, res) => { console.log('hello world'); user.create({name: 'sample'}).exec((err, userCreated) => { res.ok('userCreated'); }) } };
module.exports.routes = { 'get /add': { controller: 'UserController', action: 'createUser' },
when i LIFT it and do a request i got below error. and i have a user collection in my server db on mongo.
error: Sending 500 ("Server Error") response: ReferenceError: user is not defined at Object.createUser [as user/createuser] (E:\angular2\server-sails\test\api\controllers\UserController.js:20:5)