How to update a nested array using the rethinkdb javascript driver
I have checked other related questions, in particular this one . But since this has been answered, it looks like the rethinking of handling nested fields has changed .
I am trying to change the nested arrays 'amy' and 'joe':
{
"id": "blah" ,
"schedules": {
"amy": ['some', 'stuff', 'here'],
"joe": ['more', 'stuff', 'here']
}
}
I've tried all kinds of approaches, but I can't seem to get it to work in a single call to the database. Instead, I need to grab the existing array using one call:
r.table('whatevs').get('blah').pluck({schedules: {amy: true}})
this gives me something similar:
"schedules": {
"amy": ['some', 'stuff', 'here']
}
so I pull out schedules.amy and change the array then ...
r.table('whatevs').get('blah').update({schedules: {amy: [modified_array]}})...
What I would like to do is modify the arrays in place with a single request using .difference () and .append (). It seems to be possible now, but no matter what syntax I try to get it gets rejected.
+3
source to share