I have some data on my project firestore. It seems like this:
I am trying to sort this data by SKU. As you can see it is in a list. How can I give its field path to orderBy()
method?
CodePudding user response:
There is no way to sort the document you've shown on a SKU value, since that value exists in an array field and there could be multiple values.
If you want to sort on a specific SKU value, add a top-level field (e.g. skuForOrdering
) to the document and sort on that with orderBy('skuForOrdering')
.