users
table:
[
{
id: 123,
things: [1, 2, 3]
}
]
things
table:
[
{ id: 1, name: 'apple' },
{ id: 2, name: 'pear' },
{ id: 3, name: 'orange' }
]
Desired "joined" result:
{
id: 123,
things: [
{ id: 1, name: 'apple' },
{ id: 2, name: 'pear' },
{ id: 3, name: 'orange' }
]
}
This query works; but is it efficient? How else can this be done?
r.table('users').getAll('123').merge({
things: r.row('things').map(function(thing) {
return r.table('things').get(thing)
})
})