Martin Wittick
Martin Wittick

Reputation: 493

How to retrieve documents form firebase firestore according to a specific value in those documents in flutter?

I have the following structure on firestore, enter image description here and I want to retrieve series documents that have the same category or genre (10 docs at a time).

EX: 10 series documents of category Mystery

I know it's done using the where() and limit() methods, but I don't know how to access the objects in the categories array especially when they have no names.

Upvotes: 0

Views: 70

Answers (1)

Huthaifa Muayyad
Huthaifa Muayyad

Reputation: 12353

Currently, you cannot search for nested items within nested lists, you can however search for the exact object in the list, and in your case it's a Map<String, String>.

So, use this, which might\should work:

.where('categories', arrayContains: {"ar_title": غموض, "en_title":"Mystery"})

Upvotes: 1

Related Questions