I am having trouble with Firestore in production. There is a collection I am trying to query and it has about 200-300 documents. It's a simple query being done through a Cloud Function. I've setup a timer to log the duration of each query.
This one takes about 2-4 seconds
const missionQuery = await this._firestore
.collection(this._collectionName)
.where('active', '==', true)
.where('archived_at', '==', null)
.get();
This one takes another 2-3 seconds
let missions = missionQuery.docs.map(doc =>
plainToClass(Mission, doc.data())
);
There might be something I can do with the plainToClass, but there is nothing I know I can do with the Firestore query. I created a compose index for both fields, but it didn't help. It is pretty faster when I query slower collections.
Anyone has any idea on how to improve the performance of this query?
Thanks much