I am trying to update several documents in RethinkDB based on some pre-calculated values ββin Hash. i.e.
For a table statswith a primary key slugwith data of type
[{slug: 'foo', stats: {}}, {slug:'bar', stats:{}}]
and a hash is set with values ββsuch as
updated_stats = {
'foo' => {a: 1, b: 2},
'bar' => {a: 3, b: 4}
}
I can do it
updated_stats.each{|k,v|
r.table('stats').get(k).update{|s|
{ :stats => v }
}
}
So why can't I do the following?
r.table('stats').get_all(*updated_stats.keys).update{|s|
{ :stats => updated_stats[s["slug"]] }
}
rql shows nil as the value of updated_stats [s ["slug"]]. I would really appreciate any help with this. Thanks.
source
share