Hi I am trying to find a value that is like a variable in a mongodb database. I get no results though and I am not sure what I am doing wrong. If my username is just d then I should see some users with d in their name but I don't.
//Find a user
router.get('/findUser/:username', function (req, res) {
  var user = req.params.username;
  var db = req.db;
  var collection = db.get('userlist');
  collection.find({'username':  '/^' + user + '/' }, {}, function (e, docs) {
    res.json(docs);
  });
});
 
     
    