This query is taking longer than 10 minutes to execute and I can't figure out why. In case it's a factor, I'm running it when my app loads in react native's componentDidMount method.
There are about 12k docs in the users collection, but only about 30 of which have a fetchStatus of 206. It also seems to slow down my computer and/or internet connection while it's running.
Here's the code:
firebase.firestore().collection('users').where("fetchStatus","==",206).get()
.then(querySnap => {
console.log(querySnap.size)
})
EDIT: It seems it's something to do with my React Native environment. When I run the query via a Cloud Function, via this code, it's nice and quick:
export const count206 = functions.https.onRequest(async (request, response) => {
try {
const querySnap = await db.collection('users').where("fetchStatus","==",206).get()
console.log(querySnap.size)
response.send("ok")
} catch (error) {
console.log(error)
response.send(error.message)
}
})