Hi all Is the schema for menu collection correct h...
# community-help
s
Hi all Is the schema for menu collection correct here : https://typesense.org/docs/guide/tips-for-filtering.html#filtering-nested-array-objects ? Shouldn't ingredients.name and ingredients.concentration be arrays ?
k
Yes you are correct. Any field inside an
object[]
becomes an array.
We will fix it.
s
And if I want to sort 2 dishes in a menu based on ingredients.name, will that work with just enabling sort:true on the ingredients.name array field ?
k
Sort requires a singlular field.
s
So if I need something like that I'll need to sort the array at index time, set a document level value to array[0] and use that for sorting. right ?
The menu ingredient is a bad example but you get what I'm trying to do, right ?
k
Yes, you have to pre-sort or sort in the client.