title: NodeJs & Mongodb:Cannot Update (Patch). Returns Success but doesn't change anything
body: <p><em>I have been trying to update my "Orders" in which product, quantity, and _id are contents. After i run patch it return success but doesn't actually change anything.</em>
  My API Update code screen shot</p>
  
  <p><a href="https://i.stack.imgur.com/6KqcV.jpg" rel="nofollow noreferrer"><strong>Patch/Update code here</strong>. I am new so i cannot have image directly embedded</a></p>
  
  <p>Postman Screen shot: In this, i use body in postman to store in an object and patch it 
  <a href="https://i.stack.imgur.com/eBoID.jpg" rel="nofollow noreferrer">This is my POSTMAN api test screenshot</a></p>
  
  <p>My model of Orders</p>
  
  <p><a href="https://i.stack.imgur.com/PYwiB.jpg" rel="nofollow noreferrer">Model of Orders</a></p>
  
  <blockquote>
    <p>Patch code:</p>
  </blockquote>
  
  <pre><code>router.patch('/:id',(req,res)=&gt;{
    var update = {};
    for(var up of req.body)
    {
      update[up.new]=up.value
    }
    console.log(update )
    Product.update({_id:req.params.id},{$set:update})
      .exec()
      .then(result=&gt;{
      res.status(200).json(
        {
          Message:'Product Updated',
          Request:{
            type:'GET',
            url:'http://localhost:5000/orders/'+req.params.id
          }
        }
      )
    })
      .catch(err=&gt;{
      res.status(500).json(err)
      console.log(err)
    })
  })
  </code></pre>
  
  <blockquote>
    <p>Model Code</p>
  </blockquote>
  
  <pre><code>var express = require('express') var mongoose = require('mongoose'); 
  var orderSchema = mongoose.Schema({
    _id:mongoose.Schema.Types.ObjectId,
    product:{type:String, required:'true'},
    quantity:{type:Number,default:1}
  })
  
  module.exports = mongoose.model('Order',orderSchema,'Order');
  </code></pre>