title: Mongoose TypeError: Cannot use 'in' operator to search for '_id' in [object Object]
body: <p>I am new to mongodb and for the past couple days I have been trying to get my entries into my mongolab instance but have not had any luck. It seems when I execute the save call I get an error stating:</p>
  
  <p><code>TypeError: Cannot use 'in' operator to search for '_id' in [object Object]</code></p>
  
  <p>The [object Object] they are referring to is my Color schema.  I havent been able to find an answer yet and thought I would post here to work in parallel while I research more.  I have pasted a snipit of what I am using in hopes that it is just something stupid I am doing.  TIA!</p>
  
  <pre><code>mongoose.connect(config.db.mongodb);
  var Schema = mongoose.Schema,
      ObjectId = Schema.ObjectId;
  
  var Color = new Schema({
       hex    :   {type:String, required: true, trim: true}
      ,perc   :   {type:String, required: true, trim: true}
  });
  var Img = new Schema({
       path   :   {type:String, required: true, trim: true}
      ,color  :   [Color]
  });
  var imgModel = mongoose.model('Img', Img);
  
  exports.addImage = function(req,res){
      //First check to see if we already have the image stored
      imgModel.findOne({path: req.query.path}, function(error, image){
          if(error){ 
              console.log("Error");
              res.json(error);
          }
          else if(image === null){
              //There is no image so just store the info
              var image_data = {
                path:     req.query.path,
                color:    req.query.color
              };
  
              var img = new imgModel(image_data);
  
              img.save(function(error, data){
                  //*** This error block below is where I am 
                  //    entering and the message is displayed
                  if(error){
                      console.log("Oh noo: ",error);
                      res.json(error);
                  }
                  else{
                      console.log("Saving: ",data);
                      res.json(data);
                  }
              });
          } else{
              //The path is already here
              //res.json("Image already in db");
              console.log("Image already in db");
          }
      });
  };
  </code></pre>