Guest User

Untitled

a guest
Oct 16th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Job.update(
  2.     {estimateSet: {"$elemMatch": {_id: estimateId}}},
  3.     {$push:
  4.       {
  5.         "estimateSet.$.lineItemSet":
  6.         {
  7.           '_id': lineItem._id,
  8.           'measurements' : lineItem.measurements,
  9.           'quantity' : parseInt(lineItem.quantity),
  10.           'installPrice' : lineItem.installPrice,
  11.           'productId' : lineItem.productId,
  12.         }
  13.       }
  14.     },
  15.     {upsert: true ,safe:true},
  16.     function (err, numberAffected, raw) {
  17.       console.log("err: ", err);
  18.       console.log("numberAffected: ", numberAffected);
  19.       console.log("raw: ", raw);
  20.       err ? res.send({"error": true}) : res.send({"error": false});
  21.     }
  22.   );
Add Comment
Please, Sign In to add comment