I have a trigger on update document in firestore cloud function, in this function I want to get documents that contain a specific string. so I tried this:
const chat_threads = admin.firestore().collectionGroup('chatThreads').where(admin.firestore.FieldPath.documentId(),'array-contains', reciever_id).get().then(function (querySnapshot) {
querySnapshot.forEach((doc) => {
console.log(doc.id, " => ", doc.data());
});
});
but I get this error
Error: Invalid Query. You can't perform 'array-contains' queries on FieldPath.documentId().
Is there another way to get the result? or what can I use instead of array-contains