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.
Edit: For remote connection the Keystonejs available in the archive
.env
the propertyMONGO_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.
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/
– Leonardo Santos
Leonardo, the solution was to "a scroll of the mouse" rsrs. Thank you very much!
– Lucas Fontes Gaspareto
Still not working, I caught the link connection in the mongodb cloud assigns to the
MONGO_URI
with the login and password and thedatabase
correct, and returnsauthentication fail
or if I leave the Uri as in the example of the sitekeystonejs
(MONGO_URI=mongodb://your-server/database-name
me returns closed Connection.– Lucas Fontes Gaspareto
Hmm, from a look here: https://docs.mongodb.com/manual/reference/connection-string/, see if the URI format is right.
– Leonardo Santos
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.– Lucas Fontes Gaspareto
Did you solve it? If not, put the code you are using there for the guys... :p
– Daniel
@Blogger my password had a "@" that was giving problem. I changed it to letters and numbers only and now it’s normal. Thanks guys!
– Lucas Fontes Gaspareto