My CouchDB documents contain an array field, a simplified example:
{
"organizations": [
{ "id": "Org 1" },
{ "id": "Org 2" }
]
}
I want to find all the documents that include the organization Org 1
, using this query:
{
"selector": {"$elemMatch": {"id": "Org 1"}}
}
Is there a way to use an index for it? I tried
{
"fields": ["organizations.[].id"]
}
which does not seem to have any effect, I receive the same "no matching index found"
warning.