Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. 739 //Inserting object into the database
  2. 740 db.collection(machine + '_JobCompletion', function(err, collection) {
  3. 741 console.log('INSERTING TO DATABASE');
  4. 742 // console.log(JSON.stringify(obj));
  5. 743
  6. 744 console.log('using update DDD:');
  7. 745 collection.update({'objDate' : 'HELLO'}, {name : 'Cong'}, true, {safe:true});
  8. 746 /*
  9. 747 collection.find(function(err, cursor) {
  10. 748 console.log('inside find :D');
  11. 749 cursor.toArray(function(err, docs) {
  12. 750 console.log('inside cursor.toArray :DDDD');
  13. 751 docs.forEach(function(doc) {
  14. 752 console.log('inside collection checking >:DDDDD'); 753 console.log('doc: ' + doc);
  15. 754
  16. 755 if (doc.objDate == dateObj) {
  17. 756 console.log('========================================SAME ELEMENT FOUND! DATE: ' + dateOb
  18. j);
  19. 757 //delete found obj in database
  20. 758 }
  21. 759 else {
  22. 760 console.log('========================================NO MATCH');
  23. 761 }
  24. 762 });
  25. 763 });
  26. 764 });
  27. 765
  28. 766
  29. 767 console.log('about to insert obj XD');
  30. 768 collection.insert(obj, {safe:true}, function(err, objects) {
  31. 769 if (err) {console.warn(err.message);}
  32. 770 });
  33. 771 */
  34. 772 });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement