title: Error:Can't canonicalize query: BadValue Unsupported projection option
body: <p>User Schema</p>
  
  <pre><code>var UserSchema = new Schema({
  
      name: String,
      username: { type: String, required: true, index: { unique: true }},
      password: { type: String, required: true, select: false},
      favouriteid:[{eventid:String}]
  
  });
  </code></pre>
  
  <p>Event Schema</p>
  
  <pre><code>var EventSchema=new Schema({
      name:String,
      location:{ type:String },
      description:{type:String  },
      price: String,
      rating: {
          value: String,
          count: {type: String, default: 10},
          userrating: [{
              uservalue: String,
              userid: String
          }]
      },
      imageurl:[String],
      userimageurl:[String],
  
  
      reviews:[{ userid:String,
          username: String,
                  comment:String}]
  
  });
  </code></pre>
  
  <p>POST METHOD to push the value of userid and uservalue in Event Schema.</p>
  
  <pre><code>api.post('/rateevent', function (req, res) {
  
          var userid = req.body.userid;
          var uservalue = req.body.uservalue;
          var eventid = req.body.eventid;
  
          Event.findById({_id: eventid},
              {$push: {rating: {userrating: {uservalue: uservalue, userid: userid}}}},
              {upsert: true},
              function (err, events) {
                  if (err) {
                      res.send(err);
                      return;
                  }
                  else {
                      calculaterating(events);
                  }
              });
  
          function calculaterating(event) {
  
              event.rating.count++;
              event.rating.value = (event.rating.value * (event.rating.count - 1) + uservalue) / event.rating.count;
  
  
              res.json("rating updated");
  
  
          }
  
  
      });
  </code></pre>
  
  <p>It is showing the following error:</p>
  
  <pre><code>{
    "name": "MongoError",
    "message": "Can't canonicalize query: BadValue Unsupported projection option: $push: { rating: { userrating: { uservalue: \"5\", userid: \"56593f3657e27af8245735d7\" } } }",
    "$err": "Can't canonicalize query: BadValue Unsupported projection option: $push: { rating: { userrating: { uservalue: \"5\", userid: \"56593f3657e27af8245735d7\" } } }",
    "code": 17287
  }
  </code></pre>
  
  <p>Is the post method not correct? I have seen other mongodb documents but not able to find this type of thing. I am new to node js. Help me.</p>