title: MongoError: The positional operator did not find the match needed from the query. at Function.create()
body: <p>I am trying to update values into an object array(users) if it does not already exist in MongoDB. Here is my Schema:</p>
  
  <pre><code>    ownerid:{
          type: Number,
          required: 'This field is required'
      },
      name:{
          type: String
      },
      capacity:{
          type: Number
      },
      basePrice:{
          type: Number 
      },
      users:[{
          id: Number,
          price: Number,
          target: Number,
          frequency: Number
      }],
      filePath:{
          type: String
      },
      status:{
          type: String
      }
  }); 
  </code></pre>
  
  <p>The following is my router method:</p>
  
  <pre><code>app.post('/userBid',urlEncodedParser,function(req,res){
          resName=req.body.resName;
          console.log(resName);
          Resource.find({"name":resName},{"users.id": userid},function(err,existingUser){
              if (!existingUser){
                  console.log("already in queue");
                  //res.render('userHome.ejs');
              }
              else{
                  console.log("in update");
              Resource.update({'name': resName},
        {'$set': {
               'users.$.frequency': 1,
               'users.$.id': userid,
               'users.$.price': req.body.price,
               'users.$.target': req.body.target
         }},{'multi': true},
            function(err,model) {
          if(err){
              console.log(err);
              return res.send(err);
          }
          return res.json(model);
   });
  
                  }
          });
  
  
          });
  </code></pre>
  
  <p>I have tried using $push but that does not seem to work either. Also I can't use '0' instead of '$' as multiple users will be inserted by the users and I need to store them all. </p>