Reputation: 18939
Given a schema like:
[
{
"id": 1,
"name": "Darth",
"mylists": [
{
"name": "bucket list",
"items": [
{
"name": "play the harmonica",
"done": false
}
]
},
{
"name": "shopping list",
"items": [
{
"name": "oil",
"done": false
}
]
}
]
},
{
"id": 2,
"name": "Luke",
"mylists": [
{
"name": "bucket list",
"items": [
{
"name": "play the drums",
"done": false
}
]
},
{
"name": "shopping list",
"items": [
{
"name": "milk",
"done": false
}
]
}
]
}
]
How do I create an index on name in items. thought it would be:
.indexCreate('myItems', r.row('mylists')('items')('name'), {multi: true});
tried multi off too:
.indexCreate('myItems', r.row('mylists')('items')('name'));
but neither seem to return results?
if I stay shallow and try the following it works as expected:
.indexCreate('myIndex', r.row('mylists')('name'), {multi: true});
Upvotes: 0
Views: 196
Reputation: 18939
ended up with the following:
.indexCreate('myItems', r.row('mylists')('items').concatMap(function (x) {return x})('name'), {multi:true});
Upvotes: 0