firestore 'in' 2d array order optional
For some reason an 'in' wury with a 2d array also runs with a sort function. which is not provided or supported by other features such as ArrayUnion and ArrayRemove.
the order should be an optional parameter because using a system where we must find all other documents that have the exact same features but maybe in a different order, is not possible. there is no native sort option when using ArrayUnion, and we've been taught through firestore arrays in general, that orders of items fundamentally shouldn't be considered to exist due to idempotency.
TLDR:
ArrayUnion does not support 'in 2d array' query logic
we can't find where [["dog"], ["cat"]] === [["cat"], ["dog"]]
in ["dog","cat"]
also returns ["cat","dog","fish"]
-
Dean Julian commented
an alternative is to provide a security rules on the field that sorts the value
such as `{keywords:sortbyitem}`