Keystonejs with remote Mongo

Asked

Viewed 98 times

1

Good night!

I’m starting to study Keystonejs versão 0.3.17. Following the "Getting Started" of the official website, in the prerequisites nodejs and the mongodb, but I want to use that cloud service of mongodb.

How could I do this integration? Is it possible? Yeah, I didn’t install the mongodb on my computer and when I will execute the command node keystone that mistake happens.

inserir a descrição da imagem aqui

Edit: For remote connection the Keystonejs available in the archive .env the property MONGO_URI=mongodb://your-server/database-name

I tested the remote connection by command line using this command: mongo "mongodb://***-shard-00-00-nalfi.mongodb.net:27017,***-shard-00-01-nalfi.mongodb.net:27017,***-shard-00-02-nalfi.mongodb.net:27017/test?replicaSet=***-shard-0" --authenticationDatabase admin --ssl --username *** --password ***, the connection is successfully made.

When I set the property MONGO_URI in the .env, thus: MONGO_URI=mongodb://***:***@***-shard-00-00-nalfi.mongodb.net:27017,***-shard-00-01-nalfi.mongodb.net:27017,***-shard-00-02-nalfi.mongodb.net:27017/test?ssl=true&replicaSet=***-shard-0&authSource=admin, an authentication error is returned.

I am using exactly the same credentials and bank names and replica.

Edit: The problem was in the characters of the password used. Not yours for what reason but the password cannot have the character "@" in these connection conditions.

  • 2

    Apparently, it is trying to connect to the localhost device. Have you tried changing the Mongo URI? Have a look at the bottom of this page: http://keystonejs.com/getting-started/

  • 1

    Leonardo, the solution was to "a scroll of the mouse" rsrs. Thank you very much!

  • Still not working, I caught the link connection in the mongodb cloud assigns to the MONGO_URI with the login and password and the database correct, and returns authentication fail or if I leave the Uri as in the example of the site keystonejs ( MONGO_URI=mongodb://your-server/database-name me returns closed Connection.

  • 1

    Hmm, from a look here: https://docs.mongodb.com/manual/reference/connection-string/, see if the URI format is right.

  • That’s right, look how I’m using the URI (mongodb://******:******@*******-shard-00-00-nalfi.mongodb.net:27017,*******-shard-00-01-nalfi.mongodb.net:27017,*******-shard-00-02-nalfi.mongodb.net:27017/*******-shard-00-00-nalfi?ssl=true&replicaSet=*******-shard-0&authSource=admin). But I’ve tried several ways to ÙRI and all return error.

  • 1

    Did you solve it? If not, put the code you are using there for the guys... :p

  • @Blogger my password had a "@" that was giving problem. I changed it to letters and numbers only and now it’s normal. Thanks guys!

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.