What is the best practice for decoding Firestore documents in a listener for Swift 5? [closed]
Closed last month.
Swift Firebase Firestore Order Documents by the most items in an array contained in another array with pagination
I am currently using this whereField on my query for documents:
.whereField("tags", arrayContainsAny: ["Sports", "Fashion", "Gaming"])
.
Where the “tags” field is an array of strings (ex: [“Sports”, “Gaming”]. This works great to filter out any documents that have the tags field with none of the arrayContainsAny values in it. I am hoping to be able to sort the returned documents by number of tags inside of the arrayContainsAny array. For example if the tags field for a document had one value in the arrayContainsAny, it would have lower priority than one that had two values in the arrayContainsAny and so on. The logic would look something like this: