I have the following object:
{
"roleAttribution": {
"15497490976600-51042": {
"teams": [
"e5abb1e962e11a84ff0e41e99103cd90"
],
"persons": [
"15124323582330-17269"
]
}
},
"type": "link",
}
And need to index/query the teams
array. The problem is the roleAttribution keys are unpredictable.
Is there a way to index and query all possible keys of the object up to the teams array?
At this point, CouchDB does not support a good way to just index arrays. (https://issues.apache.org/jira/browse/COUCHDB-2867). You would need to create a view for that. If you would like to query documents based on the values of team array, you would need to iterate over the array in view map function and emit all the values there. More info about the views here http://guide.couchdb.org/draft/views.html