Reputation: 716
I'm trying to find an element of an array field in my firestore collection.
This is the field in firestore:
channels: [{name: "linkedin", date: "2020-01-02"}]
This is how I tried querying it:
firebase.firestore().collection("users")
.where("status", "==", "ACTIVE")
.where("channels", "array-contains", {
name: "linkedin"
})
Upvotes: 0
Views: 470
Reputation: 3744
array-contains
can`t perform search into objects specific values for properties.
it would work if you do something like channels: ["Linkedin", "facebook", "twitter"]
Probably you want to try to use a subcollection for channels instead, otherwise, you need to fetch all the values into channels and then apply filters in memory.
Upvotes: 1