title: Mongoose count in array of schemas
body: <p>I need to find elements in a schema and after count the total messages sent by them.
  I have tryed this code above but does not work for me.</p>
  
  <pre><code>User.find({type: 'psycologist'}).exec(function (err, users) {
      if(err){
          callback(new Error("Something went wrong"), null);
      }else{
  
          Message.count({userFrom: { "$in" : users} }).exec(function (err, counter) {
              if(err){
                  callback(new Error("Something went wrong."), null);
              }else{
                  console.log(counter); //displays 0
                  callback(null, counter);
              }
          });
      }
  });
  </code></pre>
  
  <p>Message Schema</p>
  
  <pre><code>var schema = new Schema({
      content: {type: String, required: true},
      type: {type: String, required: true, default: 'text'},
      status: {type: String, default: 'not_read'},
      created_at: {type: Date, default: Date.now},
      userFrom: {type: Schema.Types.ObjectId, ref: 'User', required: true},
      userTo: {type: Schema.Types.ObjectId, ref: 'User', required: true}
  });
  </code></pre>
  
  <p>User Schema</p>
  
  <pre><code>var schema = new Schema({
      name: {type: String, required: true},
      email: {type: String, required: true, unique: true},
      phone: {type: String, required: true},
      password: {type: String, required: true, select: false},
      type: {type: String, required: true},
      created_at: {type: Date, required: true, default: Date.now}
  });
  </code></pre>
  
  <p>Someone know how to fix it or a better way to do?
  Thanks in advance.</p>
  
  <p>If there is any expert mongo here can tell me in more details about the performance of this query for large volumes of data.</p>