I have a simple data structure:
var data = function () {
return {
users: [
{
_id: 1,
firstname: 'Bob'
posts: [
{
_id: 1,
text: 'Great post',
posted_to: [2, 3, 4] // user id's
}
]
}
]
}
}
What is the best way to dereference the users in posted_to so that when I access users[0].posts[0].posted_to I get a list of user objects, not just the id's?