My use case involves filtering the Firestore documents with 'array-contains-all' whose name I made up for the purpose of this question. However, the 'array-contains-any' already exists, but it does not check whether all the elements are present in the array, but any. I struggle to find an in-built solution or find a better approach to achieve the same result rather than querying all the documents (expensive) and then filtering the result in the Cloud Function before the final array gets passed to the client.
To give an example, we are wondering which accommodation sites have all of the following facilities that we're interested in and wish to query:
[
'lockable_bedroom_door',
'private_bathroom',
'internet',
'desk',
'safe_place_to_store_valuables'
]
out of the array of all 13 available facilities:
[
'kettle',
'microwave',
'cooker',
'washing_machine',
'fully_functional_kitchen',
'lockable_bedroom_door',
'private_bathroom',
'shared_bathroom',
'internet',
'desk',
'common_room_lounge',
'safe_place_to_store_valuables',
'free_on-site_parking'
]
How can it be achieved with keeping in mind both the Firestore limitations and the number of facilities that the user may possibly choose?