title: node.js mongodb .. the (immutable) field '_id' was found to have been altered
body: <p>I have some problem when I try to upsert my object with new ones(parsed from xml file),but I got the following error: </p>
  
  <pre><code> MongoError: exception: After applying the update to the document {_id: ObjectId('55be3c8f79bae4f80c6b17f8') , ...}, the (immutable) field '_id' was found to have been altered to _id: ObjectId('55be5f15ae
  5597401724aab3')
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>xmlFile.product_list.product.forEach(function (product) {
  
                      var productEntity = new Product({
                          product_id: parseInt(product.id),
                          parent_id: parseInt(product.parent_id),
                          sku: product.sku,
                          title: product.title,
                          pricenormal: parseFloat(product.price_normal),
                          pricewholesale: parseFloat(product.price_wholesale),
                          pricewholesalelarge: parseFloat(product.price_wholesale_large),
                          pricesale: parseFloat(product.price_sale),
                          weight: parseFloat(product.weight),
                          volume: parseFloat(product.volume),
                          unittype: product.unit_type,
                          status: product.status,
                          datecreating: product.datecreating,
                          sp: product.sp,
                          guaranteeext: product.guarantee_ext,
                          used: product.used,
                          statusfull: product.status_full,
                          description: null,
                          url: null
                      });
                      items.push(productEntity);
  
                  });
  
  
  items.forEach(function (product) { //update or create new products
  
                      Product.findOneAndUpdate({product_id: product.product_id}, product, {upsert: true}, function (err) {
                          if (err)  return updateDBCallback(err);
                          updateDBCallback(null, 'saved');
  
                      });
  
                  });
  </code></pre>
  
  <p>I tried to use hints like:</p>
  
  <pre><code>                //product._id = mongoose.Types.ObjectId(); //doesn't work
                  //delete product._id // doesn't delete _id from product
  </code></pre>
  
  <p>but they didn't help.
  So I don't want to update my product._id , I just want to update the other fields.</p>