Home > OS >  Flutter Firebase whereQuery in collectionGroup
Flutter Firebase whereQuery in collectionGroup

Time:10-25

Why I cant use whereQuery in collectionGroup.

When I use whereQuery like that;

Query colRef = _firestore.collection("users");

    colRef = colRef.where("name", isEqualTo: widget.name);

Its working, but when I use whereQuery like that;

Query colRef = _firestore.collectionGroup("users");
    
        colRef = colRef.where("name", isEqualTo: widget.name);

Its not working, while geting the data, I query whether there is an error by using hasError and if else, and I get an error. and I must use collectionGroup while getting data from firebase.

Is there a solution to use whereQuery in collectionGroup?

Firestore Index Settings

I guess I need to somehow enable the disabled options here, but I don't know how to do it.

In summary I want all users in the application to have access to all kinds of data that I specify in the collection Group.

CodePudding user response:

I need to set the composite and exemption part at the same time, when I set both parts according to the paths I want to query, the problem was solved.

  • Related