title: Mongodb and Express
body: <p>I am trying to implement related data concept in MongoDB. I have one collection for user and one collection for posts. Now posts collection has created_by which refers to users collection. However I am unable to retrieve related data. Below are some of the schema I have.</p>
  
  <pre><code>{   "posts"
          {
              created_by:{ type:mongoose.Schema.ObjectId, ref:'User'},
              created_at:{ type:Date,default:Date.now },
              text:String
          }
  }
  {
         "users"
           {
               username:String,
               password:String,
               created_at:{type:Date,default:Date.now}
         }
  }
  </code></pre>