Reputation: 47871
Say I have a users table with an embedded followers array property.
{
"followers": [
"bar"
] ,
"name": "foo" ,
}
In rethinkDb, what's the best way to add a username to that followers property. i.e. add a follower to a user.
In mongodb I would use the addToSet command to add a unique value to the embedded array. Should I use the merge command?
Upvotes: 2
Views: 63
Reputation: 5289
RethinkDB has a setInsert
command. You can write table.get(ID).update({followers: r.row('followers').setInsert(FOLLOWER)})
.
Upvotes: 1