Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. return db.collection('people')
  2.  
  3. .then( (collection) => {
  4. // Store reference to collection for future use
  5. peopleCollection = collection;
  6.  
  7. return collection.find({a:1})
  8. })
  9.  
  10. .then( (people) => {
  11.  
  12. // Process each people
  13. return people.each( (person) => {
  14.  
  15. person.b = 2;
  16.  
  17. // Where peopleCollection is a reference to my collection
  18. return peopleCollection.update({_id: person._id}, person)
  19. })
  20. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement