Category Archives: apigee-baas

Usergrid query on unknown sub properties

I'm trying to query a collection of data with entities that contain the "related" property:

...,{ related : 
       { global: [{name: "foo"}, {name: "bar"}] },
       { local: [{name: "bar"}] },
       { random: [{name: "foo"}] },
       { dingbat: [{name: "baz"}] },
    }

I want to write a query which selects all entities which have name="foo" anywhere within the related property.

I can do this just fine:

select * where related.global.name='foo'

However there could be any number of keys within the "related" property so I can't just AND them all into a single query. Trying to do something like this (which doesn't work)

select * where related.*.name='foo'

Is there any way to achieve this?