Reputation: 2269
I cannot figure out how to convert objects into a JsonArray.
r.db('data').table('user').filter({'_deleted':false}).pluck(['id'])
My result looks like this:
{
"id": "10008590"
},
{
"id": "10006821"
}
And i want it to look like this:
[ "10008590", "10006821"]
what do i add to a query after .pluck()
?
Upvotes: 0
Views: 129
Reputation: 3040
Simple, after the pluck()
you use the map()
function to extract the id field:
.map(function(doc){return doc('id')})
in shorter form:
.map(r.row('id'))
Note: in the UI i also needed .coerceTo("array")
to the end
Upvotes: 1