Hi Stefan!

You will have to use map functionality for this I believe. It might look 
something like this I believe.

let dataRequired = pouchDB.query((doc) => {
    if(refs.foo.includes(key) || refs.bar.includes(key)) {
        emit(doc._id);
    }
},
{
    include_docs: true
})

I hope this helps.

Krishna.

> On 06-Jul-2021, at 3:12 PM, Stefan Klein <[email protected]> wrote:
> 
> Hi,
> 
> I'm trying to migrate an existing view to mango since this would allow for
> some optimisations.
> The documents contain a structure like:
> 
> "refs" : {
>     "foo" : ["ABC","TFG"],
>     "bar" : ["KOL","ABC"]
> }
> I need to find all documents where any of the arrays contain a given value,
> regardless of the key (which is not known in this case).
> 
> With the existing operators it seams not to be possible to match on the
> values of an object.
> (A very big $or would technically possible, but that would be really ugly.)
> 
> Am I missing something?
> 
> regards,
> Stefan

Reply via email to