title: Error in finding user id from chatbox name
body: <p>I am currently doing a project on online chatbox. However, i was stuck when I need to get the id of friends of the user by getting the name of the friend(eg. when i have Ivan in my friendList, I can get his id in the database) when logging in the server. I can get the name of the friend, say, Ivan, but i tried many times and still dont know how to use the name i found to find the id of Ivan in the server. I am using mongodb and node.js to do this project. Here is my current code:</p>
  
  <pre><code>router.get('/load', function(req, res)
  var db = req.db;
  var collection = db.get('userList')
  if(req.session.userId)
  {
   var id = req.session.userId;
   collection.find({"_id": id},{fields:{"_id":0, "friends.name":1}}, function(err, docs)
   res.json(docs);
   )}
   }
  </code></pre>
  
  <p>And here's what the database structure kind of looks like:</p>
  
  <pre><code>{
   "_id": ObjectId(5a23e06aa11f6589e02d8fcf),
   "name": "Ken",
   "password": "12345678",
   "friends":[
     {
       "name" : "Andy",
       "lastmsg": "0"
      },
      {
       "name" : "Ivan",
        "lastmsg" : "1"
       }
      ]
   }
  </code></pre>