mongoDB Atlas ♥︎ Sailsjs (waterline sails-mongo adapter)
Asked Answered
B

3

5

i just created a MongoDB Atlas account.

I'm using sails with waterline sails-mongo adapter

but I can't manage to connect via my app.

  • Everything is up to date.
  • I can connect to any other DB (localhost, digitalocean server, ...)
  • I can also connect to that MongoDB Atlas Database via their tool (MongoDB Compass) and via shell with the mongo cmd

but it seems like sails-mongo is just not working with that db, which requires a very up-to-date mongo version

Is someone else using MDB Atlas && sailsjs ? (I thought about refactoring my app, but it's starting to be huuge and it just seems impossible to use the "mongodb" adapter)

Versions : - node : 6.3.1 - npm : 3.10.6 - mongo (shell) : 3.4.2 - sails-mongo npm module : [email protected]

Bellina answered 10/3, 2017 at 11:5 Comment(1)
What error do you have? Please post some code, maybe read How to askLemal
B
15

Hey people thanks to your tips and SailsJS team I was able to figure out a few things that can help you fix this issue (I was able to):

By looking at the sails v1.0 code, lost of this things will be fixed by that update ;) Thanks SailsJS Team!

Bocage answered 11/4, 2017 at 4:51 Comment(2)
you can also update sails-mongo to the latest beta version by doing npm install sails-mongo@betaShortlived
After migrating from mLab to Atlas the only thing I was missing was the ssl: true part. Thank you, sir.Scammony
H
4

it seems like sails-mongo is just not working with that db, which requires a very up-to-date mongo version

You hit the nail on the head -- the current sails-mongo adapter for Sails v0.12.x uses a version of the native MongoDB driver that doesn't support all the features required to work with Atlas (e.g. authSource). See this issue on Github.

We're finishing up the last bits on the sails-mongo adapter for Sails 1.0, which supports the latest options and has been tested successfully with Atlas, so now might be a good time to start preparing to upgrade to version 1.0. After Sails 1.0 is released we'll only be doing bug fixes and security patches to modules that work with v0.12.x.

Hannon answered 10/3, 2017 at 19:27 Comment(1)
Hey Sgress454, thank you for your answer. I guess I'll need to refactor anyway :)Bellina
V
0

The error message suggests that the connection is timing out. Step one would be to check your configuration, is it correctly populated with this format in config/connections.js?

  // MongoDB is the leading NoSQL database.
  // http://en.wikipedia.org/wiki/MongoDB
  //
  // Run:
  // npm install sails-mongo
  //
  someMongodbServer: {
    adapter: 'sails-mongo',
    host: 'localhost',
    port: 27017,
    // user: 'username',
    // password: 'password',
    // database: 'your_mongo_db_name_here'
  },

If it's not your configuration, it's likely an incompatibility with your version of sails, sails-mongo, or Mongo DB. Which versions of these are you running?

Varini answered 10/3, 2017 at 17:54 Comment(2)
Hey Solumos, Thank you for your time and answer. my config looks like someMongodbServer: { adapter: 'sails-mongo', url: process.env.MONGODB_URI, }, see ref : docs.mongodb.com/manual/reference/connection-string But, I think you're right, that's what I have in mind. sails-mongo is not enough up to date to work with mongoDB AtlasBellina
I'm pretty sure you can select the version of mongoDB you want to be installed on your cluster with Atlas. I think the only caveat to that is if you go with the free tier M0 I think its called which forces you on to the fixed version, wiresomething or other.Countdown

© 2022 - 2024 — McMap. All rights reserved.