I've read this link Firestore: How to get random documents in a collection but it looks like my problem is different. Because these solutions are not good for queries with where conditions.
My collection looks like this:
I have 140K documents in this collection. I want to get random X amount of documents filtered by any category.
My code looks like this (Swift):
Firestore.firestore().collection("quotes") .whereField("categories", arrayContainsAny: ['change']) .limit(to: 25) This code always returns the same documents. How can I get random documents filtered by category?

placeIdas reference to your query. First, you should create a function that generates a random number. You may refer to this thread for generating random number. Add this.whereField("placeId", isGreaterThanOrEqualTo: randomNumber)to your query after getting a random number. This will randomize getting documents from Firestore based on the random number you generated and the placeId of your documents. Let me know if this can be applied to your use-case.