Open AliHammami opened 5 years ago
@AliHammami Thanks for posting! We'll take a look as soon as possible.
In the mean time, there are a few ways you can help speed things along:
Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.
For help with questions about Sails, click here.
@AliHammami Thanks for the detailed example code.
Have you tried setting id: { type: 'string', columnName: '_id' },
under attributes?
@johnabrams7 i've just tried it, I have the same issues.
@AliHammami It looks like it's having trouble reaching cluster0-kqqjs.mongodb.net
- I'm curious if the test?w=majority
query string part of the URL is possibly confusing the adapter. Is that required and what happens without it?
I don't know if it's required. I deleted it and I have this issue now:
Failed to lift app: Error: Invalid configuration for datastore
mongodb
: No database could be determined from configuration (tried to usedatabase: undefined
).
But if i only delete ?w=majority
, I have the same issue:
Failed to lift app: Error: Consistency violation: Unexpected error creating db connection manager:
MongoError: failed to connect to server [cluster0-kqqjs.mongodb.net:27017] on first connect [MongoError: getaddrinfo ENOTFOUND cluster0-kqqjs.mongodb.net cluster0-kqqjs.mongodb.net:27017]
This is the uri link from atlas mongodb, maybe it can help you to resolve my problem:
mongodb+srv://ali:
I saw in an another post that I have to delete the +srv
and retryWhites=true
@AliHammami see this: https://github.com/balderdashy/sails/issues/4590#issuecomment-494669327
@glemiere I've tried it:
adapter: 'sails-mongo',
host: 'localhost',
port: 27017,
database: 'todolist',
user:'ali',
password: 'password',
And I've get this error:
Failed to lift app: Error: Consistency violation: Unexpected error creating db connection manager:
MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]
@AliHammami I found this potential fix on StackOverflow for the same issue with sails-mongo and Atlas mongoDB:
Thank you guys for your help! I still have the issue :(.
@AliHammami the error you link is showing that you tried to connect to localhost but your server is at cluster0-kqqjs.mongodb.net
.
Try:
adapter: 'sails-mongo',
host: 'cluster0-kqqjs.mongodb.net',
port: 27017,
database: 'YOURDBNAMEHERE',
user:'YOURDBUSERHERE',
password: 'YOURPASSWORDHERE',
Just make sure you have the right information at the right place. Do you know your db name? Are you sure your user has read/write access to it?
@glemiere I still have the issue. I know the db name, I have read/write access to it. I tried to connect it with an express.js project and it works fine but I don't understand why it don't want to connect with sails.
@AliHammami - Good to know the credentials are confirmed working. Do you have an example of the working db configuration code from express.js to compare?
DID U FIX THIS?
I have the same problem. I need help
Hey guys I have the same issue and I found the solution on StackOverflow.
Basically you need to update the connection driver version in mongo atlas dashboard from Node.js 3.0 or later driver version to Node.js 2.2.12 or later version.
Thank you @YassineMd for finding that.
Hope this will help @AliHammami @Lozcep @w3villa-mavin
Hey guys I have the same issue and I found the solution on StackOverflow.
Basically you need to update the connection driver version in mongo atlas dashboard from Node.js 3.0 or later driver version to Node.js 2.2.12 or later version.
Thank you @YassineMd! This finally worked!
Hey guys I have the same issue and I found the solution on StackOverflow. Basically you need to update the connection driver version in mongo atlas dashboard from Node.js 3.0 or later driver version to Node.js 2.2.12 or later version.
Thank you @YassineMd! This finally worked!
I worked for me to. You can close this issue
Node version: v10.10.0 Sails version (sails): "^1.2.3" ORM hook version (sails-hook-orm): "^2.1.1" Sockets hook version (sails-hook-sockets): "^2.0.0" Organics hook version (sails-hook-organics): Grunt hook version (sails-hook-grunt): "^4.0.1" Uploads hook version (sails-hook-uploads): DB adapter & version (e.g. sails-mysql@5.55.5): "sails-mongo": "^1.0.1" Skipper adapter & version (e.g. skipper-s3@5.55.5):
Hi everybody,
I need some help. I can't connect to Atlas mongoDB and I don't understand why.
this is the error that I get:
Here's my datastore.js file:
My model.js file
My Tasks.js file on the model folder
Thank you