Querying User MetaData

I have a user meta Data field of

"teams": [
    {
      "title": "Premiers",
      "role": "Supporter",
      "aka": "Dazza"
    },
    {
      "title": "Presidents",
      "role": "Management",
      "aka": ""
    }
  ]

I want to get users who have a title of Premiers and role of Management.
My query:
user_metadata.teams.title:“Premiers” AND user_metadata.teams.role:“Management”

In my sample data above it will return this user because in one team the title is Premiers and in another the role is Management and so it matches.
But I only want managers in the premier team to be returned.

Any ideas?

Hi @Darrin

Welcome back to the Auth0 Community!

Thank you for posting your question, I’ve checked with the Docs, and the reason the mentioned query is not working is due to the Logical Operator constraints.

  • Operators (AND, OR, NOT) work on all normalized user fields and root metadata fields.

You can try to add an additional flag that would set a boolean value for the search value i.e. "isManagerInPremiers": true, that would allow searching thru only one argument.

Thanks
Dawid

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.