title: how to query mongodb from nodejs via mongojs module ? (server is openshift)
body: <p>I was trying out mongodb and nodejs on openshift, using mongojs to interface between nodejs and mongodb.</p>
  
  <p>In mongoshell I ran "use nodejs" and defined a "scores" collection. I saved some data in it and its correctly showing.</p>
  
  <p>In app.js file of nodeserver
  I have </p>
  
  <pre><code>self.routes['/db'] = function(req, res) {
  var db = require("./db");
          db.scores.find(function(err,docs){res.send(docs);});        
      };
  </code></pre>
  
  <p>and in db.js file I have</p>
  
  <pre><code>var dbName = "/nodejs";
  var databaseUrl = process.env.OPENSHIFT_MONGODB_DB_USERNAME + ":" +  process.env.OPENSHIFT_MONGODB_DB_PASSWORD + "@" + process.env.OPENSHIFT_MONGODB_DB_HOST + ":" +  process.env.OPENSHIFT_MONGODB_DB_PORT+ dbName;
  // "username:password@example.com/mydb"
  var collections = ["scores"]
  var db = require("mongojs").connect(databaseUrl, collections);
  module.exports = db;
  </code></pre>
  
  <p>I am unable to get any data when I go to url  mydomain.com/db</p>
  
  <p>Can someone please point out what  am doing wrong. The database is connecting. I am unable to find all from scores collection.</p>
  
  <pre><code>self.routes['/db'] = function(req, res) {
      var db = require("./db");
      db.scores.find(function(err,docs){res.send(docs);});        
  };
  </code></pre>