diogogmt

mongooseUpdate

Mar 20th, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. Job.update(
  2. {estimateSet: {"$elemMatch": {_id: estimateID}}},
  3. {$push:
  4. {
  5. "estimateSet.$.lineItemSet":
  6. {
  7. 'name' : lineItem.name,
  8. 'description' : lineItem.description,
  9. 'quantity' : parseInt(lineItem.quantity),
  10. 'cost' : parseInt(lineItem.cost),
  11. '_id': lineItem._id
  12. }
  13. }
  14. },
  15. {upsert:false,safe:true},
  16. function (err) {
  17. console.log("Job.update - push lineItemSet");
  18. console.log("err: ", err);
  19. }
  20. );
Advertisement
Add Comment
Please, Sign In to add comment