Assistance Required for Implementing Firestore whereIn Query by Document ID

Hi,

I am currently working on a project where I need to query a Firestore collection based on an array of document IDs. Specifically, I am trying to use the whereIn query in Firestore to retrieve documents from a collection whose document IDs match those in a given array.

I understand that in native Firestore queries, this is typically achieved using the firebase.firestore.FieldPath.documentId() method. However, I am facing difficulties in translating this into a query within the Retool interface.

Could you please guide me on how to set up a whereIn query by document ID in Retool? Here's the general structure of the Firestore query I am trying to replicate:

const patientIds = ['id1', 'id2', 'id3', ...];  // Array of document IDs
const query = firestore.collection('patients').where(firebase.firestore.FieldPath.documentId(), 'in', patientIds);

My main question is how to specify FieldPath.documentId() in a Retool query when using the in operator. Any assistance or alternative suggestions to achieve this functionality within Retool would be greatly appreciated.

Thank you for your support.

1 Like

I need the same information. Is there a way to query a Firestore database/collection where "DocumentID" IN [listOfDocumentIDs] and return back a list of results, suitable for table?

@squero @yeugenius FYI you can use the Raw mode to write Firebase queries that we don't support.

1 Like