title: Mongoose query for subdocument containing array of objectId's
body: <p>I have the following schema:</p>
  
  <pre><code>var groupSchema = mongoose.Schema({
  name: {type: String, index: {unique: true, dropDups: true}},
  createdBy: String,
  availableModules: [Number],
  members: [{type: Schema.Types.ObjectId, ref: 'User'}]
  });
  </code></pre>
  
  <p>The "members" field is just a straight up array of ObjectID's from the user table.  I need to check for the existence of a given ObjectId (user._id) in the members subdocument collection before I take some other action.  </p>
  
  <p>I've tried stuff like:</p>
  
  <pre><code>Group.find({req.body.uid}, {$in: {"members"}}, function(grps){..});
  </code></pre>
  
  <p>But this doesn't work.  I've tried a myriad of other methods but can't seem to get anything working.  I'd think this would be easy, but I can't seem to figure it out.</p>
  
  <p>EDIT Further Investigation:</p>
  
  <pre><code>User.findOne({"local.email": req.body.user.email}, function(err, user){
      Group.find({"members": user._id}, function(grps){
          if(grps){ //do something}
      });
  });
  </code></pre>
  
  <p>grps is null no matter what way I do it.. tho in the mongo console it's returning the value when using the ObjectId("..") notation</p>
  
  <pre><code>db.groups.find({members: ObjectId("5371a4763b32c3620728acb5")})
  </code></pre>