I have deployed the MongoDb using the Google cloud Launcher and BITNAMI. I
got the username and password from the deployment console.
I used the keys.json for the credentials in nodejs application -
{
"mongoHost": "104.198.142.198",
"mongoPort": "27017",
"mongoDatabase": "transM",
"mongoUser": "root",
"mongoPass": "secret"
}
My App.js -
const username = nconf.get('mongoUser');
const pass = nconf.get('mongoPass');
const host = nconf.get('mongoHost');
const port = nconf.get('mongoPort');
let uri = `mongodb://${username}:${pass}@${host}:${port}`;
if (nconf.get('mongoDatabase')) {
uri = `${uri}/${nconf.get('mongoDatabase')}`;
}
console.log(uri);
mongoose.connect(uri);
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function () {
// we're connected!
console.log("Connected correctly Database to server");
});
The stderr log shows Authentication fails. But when I try remote connection
using the same in terminal -
mongo admin --username root -p --host 104.198.142.198 --port 27017
it lets me log in.
Please note -
In the example by google the mlabs hostname is used -
https://cloud.google.com/nodejs/resources/databases/mongodb
{
"mongoHost": "ds053894.mlab.com",
"mongoPort": "53894",
"mongoDatabase": "mydata",
"mongoUser": "myapp",
"mongoPass": "mypword",
}
{
"mongoHost": "ds053894.mlab.com",
"mongoPort": "53894",
"mongoDatabase": "mydata",
"mongoUser": "myapp",
"mongoPass": "mypword",
}
Can you please help to get the correct host name for BITNAMI Mongo instance.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/4eeeecd6-f38a-47ca-affb-6ee4213145cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.