Search code examples
janrain

Use of complex filters in Janrain's entity.find


I'm having trouble figuring out how to supply the filter parameter based on nested json objects within the entity schema. I can easily use the outer basic fields like filter="givenName='Taylor'" but to go deeper within the hierarchies of data, I can't find a way to do it.

In addition to that, I'm having trouble figuring out how to supply a filter parameter to just query the records that contain a specific provider such as facebook. The only way I'm seeing is by looking at each json object under "profiles", then "accessCredentials" then "domain".

Another example is when I was trying to use "gender='male'" as a filter. Since gender isn't at the outer level of the schema, this doesn't seem to work. It lives within the Facebook profile, then gender, so I assume the filter needs to be able to specific that key at a lower level or along a path of some sort.

Thanks for any advice!


Solution

  • For doing a few levels deeper in the schema in searches, you can use dot or slash notation.

    profiles.profile.quotes.quote = 'Love is a snowmobile racing across the tundra and then suddenly it flips over, pinning you underneath. At night, the ice weasels come. - Matt Groening'
    

    or

    profiles/profile/quotes/quote = 'wat'
    

    As for gender, you might try

    gender = 'male' OR profiles.profile.gender = 'male'