Janaka
Janaka

Reputation: 2795

Firebase how to filter collection with a sub collection

I have a collection called "posts". Posts has sub collection called "feedback".

when a user give feedback to a post his id and comment get added to feedback sub collection.

Now I want to find posts that user has not given a feedback.

Something like following sql query

select * from posts where userId not in (select userId from feedback)

Can someone provide advice on how to do this?

Upvotes: 0

Views: 585

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317402

Firestore doesn't support joins between collections or subqueries. You won't be able to perform any queries that use data from more than one collection.

Also, querying for non-existence isn't supported by Firestore. So, you won't be able to query for the absence of data in a field. Firestore requires that all queries be able to use a highly performant index, which only tracks data present in documents.

Upvotes: 1

Related Questions