Try whit this:
function getPost(id) {
return Post
.findOne({id: id})
.then( post => {
return post;
});
}
using Q module
function getCommentsAndLinks(post) {
return Q.all([
Comment.find({id: post.id}),
Links.find({id: post.id})
])
.done( results => {
let comments = results[0];
let links = results[1];
return [post, comments, links];
})
.catch( err => {
// handle err
})
on controller
getPost(postId)
.then(getCommentsAndLinks)
.then( results => {
let post = results[0];
let comments = results[1];
let links = results[2];
// more code here
})
.catch( err => {
// handle err
})
but i suggest you not save string of IDS, save the instance of object, so you can use populate to get all data of comments and links, something like this:
Post
.findOne({id: id})
.populate('comments')
.populate('links')
.then( post => {
// here have the post with data of comments and links
});