Created
September 6, 2016 08:08
-
-
Save ermst4r/efb43793709f99f2dc8a687fb5651b71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
run:function() | |
{ | |
Feed.find({}).then(function(feed) { | |
var page = 1, | |
lastPage = feed.length; | |
async.whilst(function () { | |
return page <= lastPage; | |
}, | |
function (next) { | |
console.log(feed[page]); // Get value by incrementor because it is an async array | |
/** | |
* Or just do an insert into mongo | |
* mongo.insert(feed); should be a json array | |
*/ | |
/** INSERT HERE INTO MONGO **/ | |
page++; | |
next(); | |
}); | |
}, | |
function (err) { | |
// All things are done! | |
console.log("Done isnerting"); | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment