exports.test = function(req,res,callback){
var i=0;
req.files.forEach(function(key){
console.log(i);
console.log('blah')
albumModel.findOne({'_id':'58c916720ee85f12c0246d1c'},function(err,album){
console.log('inside findone');
})
console.log('hello');
i++;
})
}
There is a problem in above code that the findOne function is not repeating according to foreach.It is executing all the codes above findoNe and after findOne but not that inside findOne. The output of the following code is:-
0
blah
hello
1
blah
hello
2
blah
hello
But my expected output is:-
0
blah
inside findone
hello
1
blah
inside findone
hello
2
blah
inside findone
hello
Plzz help to get my expected output...
via lal rishav
No comments:
Post a Comment