Guest User

Untitled

a guest
Oct 21st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. for(let i=0; i<test.length; i++;){
  2. db.collection('Parent').find({ "Id" : test[i].Id }).toArray(function(err, result){
  3. if(result.length > 0){
  4. db.collection('anotherCollection', function(err, collection){
  5. collection.insert({
  6. field1: test[i].field1,
  7. field2: test[i].field2
  8. })
  9. })
  10. }
  11. })
  12. }
Add Comment
Please, Sign In to add comment