title: Mongoose - query to get data from multiple collections
body: <p>I want to <strong><em>get query of the mongoose</em></strong> in nodejs application as describe below out put.<br>
  user.js, comment.js and post.js are the model files I used.</p>
  
  <p><strong>user.js</strong>  </p>
  
  <pre><code>var mongoose = require('mongoose');  
  var Schema = mongoose.Schema;  
  var ObjectId = Schema.ObjectId;  
  
  var userSchema = new Schema({  
          nick_name:{type:String},  
          email: {  
              type: String,  
              trim: true,  
              required: '{PATH} is required!',
              index: true,
          },     
      },{ collection: 'user'});
  
  var User = mongoose.model('User', userSchema);
  module.exports = User;  
  </code></pre>
  
  <p><strong>comment.js</strong>  </p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  var ObjectId = Schema.ObjectId;
  
  var commentSchema = new Schema({  
           comment: type:String,  
           user_id:{
              type:Schema.Types.ObjectId, ref:'User'
           },  
           is_active :1
  },{ collection: 'comment'});
  </code></pre>
  
  <p><strong>post.js</strong></p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  var ObjectId = Schema.ObjectId;
  
  var postSchema = new Schema({
          post: type:String,
          user_id:{
             type:Schema.Types.ObjectId, ref:'User'
          },
          is_active :1
  },{ collection: 'post'});
  </code></pre>
  
  <p><strong>wants to get out put as follows:</strong></p>
  
  <pre><code>{
   "nick_name":"prakash",
   "email":"prakash@mailinator.com",
   "comments":[
        {
        "comment":"this is a comment text1",
        "is_active":1,
        },
        {
        "comment":"this is a comment text2",
        "is_active":1,
        }
   ],
   "posts":[
        {
        "post":"this is a post text1",
        "is_active":1,
        },
        {
        "post":"this is a post text2",
        "is_active":1,
        },
        {
        "post":"this is a post text3",
        "is_active":1,
        },
   ]
  }
  </code></pre>
  
  <p><strong>dependencies</strong></p>
  
  <pre><code>"express"  =&gt; "version": "4.7.4",
  "mongoose" =&gt; "version": "4.4.5",
  "mongodb"  =&gt; "version": "2.4.9",
  "OS"  =&gt; "ubuntu 14.04 lts 32bit",
  </code></pre>
  
  <p>if query is not possible ,please suggests me a proper mongoose plugn.
  but I don't want to any changes in user.js file and its userSchema object.</p>