Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. Post.find().then(posts=> {
  2. async.forEach(posts, function(post, done) {
  3. Cat.find().where('posts').in([post.id]).then(categories=> {
  4.  
  5. post.categories = categories;
  6.  
  7. var id=mongoose.Types.ObjectId(post.id);
  8. File.findOne({'related.ref': id}).then(pic=>{
  9. post.pic=pic;
  10.  
  11. });
  12. })
  13. //res.send(posts);????
  14. });
  15. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement