Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- return db.collection('people')
- .then( (collection) => {
- // Store reference to collection for future use
- peopleCollection = collection;
- return collection.find({a:1})
- })
- .then( (people) => {
- // Process each people
- return people.each( (person) => {
- person.b = 2;
- // Where peopleCollection is a reference to my collection
- return peopleCollection.update({_id: person._id}, person)
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement