How do you use Mongoose: https://github.com/Automattic/mongoose ?
The example here: https://github.com/IBM-Bluemix/compose-mongodb-helloworld-nodejs worked great. Here is a simplified snippet of the example mongo code:
MongoClient.connect(credentials.uri, { // step 1: connect
mongos: {...},
function(err, db) {
if (err) {
console.log(err);
} else {
mongodb = db.db("examples"); // step 2: create or use database
}
}
);
I can not find a mongoose example that uses a two step connection process.
I noticed that Compose for Mongodb does not support a direct connect to the existing examples database. Connecting to this url:
mongodb://admin:PW@bluemix...4.dblayer.com:22601,bluemix...0.dblayer.com:22601/examples'
results in 'MongoError: authentication fail'