title: Node, Mongoose connection to IBM Bluemix Compose for Mongodb
body: <p>How do you use Mongoose: <a href="https://github.com/Automattic/mongoose" rel="nofollow noreferrer">https://github.com/Automattic/mongoose</a> ?</p>
  
  <p>The example here: <a href="https://github.com/IBM-Bluemix/compose-mongodb-helloworld-nodejs" rel="nofollow noreferrer">https://github.com/IBM-Bluemix/compose-mongodb-helloworld-nodejs</a> worked great.
  Here is a simplified snippet of the example mongo code:</p>
  
  <pre><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
          }
      }
  );
  </code></pre>
  
  <p>I can not find a mongoose example that uses a two step connection process.</p>
  
  <p>I noticed that Compose for Mongodb does not support a direct connect to the existing examples database.
  Connecting to this url:</p>
  
  <pre><code>mongodb://admin:PW@bluemix...4.dblayer.com:22601,bluemix...0.dblayer.com:22601/examples'
  </code></pre>
  
  <p>results in 'MongoError: authentication fail'</p>