Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mongoose.connection.once('open', function() {
- User.find({}, function(err, users) {
- async.each(users, function(user, done) {
- console.log('in ' + user.email);
- async.waterfall([
- function(callback) {
- getInfos(user, callback);
- },
- function(infos, callback) {
- console.log('1 ' + user.email);
- User.update({ email: user.email }, {
- $set: {
- 'infos.no1': infos.no1,
- 'infos.no2': infos.no2
- }
- }, function(err) {
- console.log('2 ' + user.email);
- callback(null, 'updated');
- });
- }
- ], function(err, result) {
- done();
- });
- }, function(err, response) {
- console.log('DONE');
- });
- });
- });
- in user1@nope.com
- in user2@nope.com
- 1 user1@nope.com
- 2 user1@nope.com
- 1 user2@nope.com
- 2 user2@nope.com
- DONE
- in user1@nope.com
- 1 user1@nope.com
- 2 user1@nope.com
- in user2@nope.com
- 1 user2@nope.com
- 2 user2@nope.com
- DONE
Add Comment
Please, Sign In to add comment