enlightenedOne
enlightenedOne

Reputation: 171

Firestore - How to perform "NOT IN" like you would in SQL

I have a collection of "quizes" that users will participate in. When a user takes a quiz I create a document in "results" collection for with that userId and quizId. I want my app to pull all docs from "quizes" collection excluding the ones that the user taken. In SQL I would do "NOT IN" clause and accomplish that, but I have no idea how to best approach this in Firestore.

Upvotes: 0

Views: 37

Answers (1)

Thingamajig
Thingamajig

Reputation: 4465

There's no equivalent query in Firestore. You would need to pull all the data and determine which docs are relevant on clientside.

Alternatively, you can create a list of all quizzes for each user and maintain this list. You could add and remove quizzes for each user as they become relevant/irrelevant to show them.

Upvotes: 1

Related Questions