How to query a field in a document that is an Object (simple json map)

67 Views Asked by At

I have a collection "users" and each document have the structure:

name - string

uniqueName - string

clubs - Object (json map)

clubs field can look like this per example {club1: 1, club2: 2, club3: 3}

So basically it has the name of the club as a key and an index which is an int as the value.

lets say I want to get a list of documents of all users that are in club2? how can i make that search? note that in this example the values in the json are irrelevant, I only care about the keys, values are meant to only be returned, not used to search.

client.collection('users').documents.search(searchParameters);

how will the searchParameters look like?

searchParameters = {'q': 'club2', 'query_by': 'clubs'}?

trying to learn how to query objects in typesense

0

There are 0 best solutions below