Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var itemsProcessed = 0;
- async.forEach(categories, function(category, cb) {
- Audit.find({
- 'category_id': category._id
- }, 'created_at updated_at user_Id entreprise_id nom _id category_id', function(err, auds) {
- category.products = [];
- category.count = 0;
- if (err) res.send(err);
- category.products = auds;
- category.count = auds.length;
- itemsProcessed++;
- if (itemsProcessed == categories.length) {
- cb();
- }
- });
- }, function() {
- res.json(categories);
- });
Add Comment
Please, Sign In to add comment