0

snapshot1 uses and single collection and snapshot2 uses a collection group

final snapshot1 = await FirebaseFirestore.instance
    .collection('users')
    .doc('115309562732908784445')
    .collection('user_activities')
    .where('userGroupIDs', arrayContains: 'IIPwobuR3YLrOoLH3TeS')
    .get();
final snapshot2 = await FirebaseFirestore.instance
    .collectionGroup('user_activities')
    .where('userGroupIDs', arrayContains: 'IIPwobuR3YLrOoLH3TeS')
    .get();

snapshot1 generates fine by snapshot2 throws

Exception has occurred.
FirebaseException ([cloud_firestore/failed-precondition] Operation was rejected because the system is 
not in a state required for the operation's execution. If performing a query, ensure it has been 
indexed via the Firebase console.)

but I'm not getting the auto-generate URL. The above message overlapped the VSCode editor window. I didn't see any URL messages in the Debug Console nor the Firestore logs.

Is there something wrong with my query? Or maybe sometimes you have to create them manually?

1
  • 1
    Can you add your edit as an answer?, this can help others Commented Jan 27, 2021 at 16:42

1 Answer 1

1

I built the Index manually and it worked fine. Was simple to do following Todd's blog. As a test, I deleted a couple of my existing Indices and the debugger properly gave me a URL to rebuild. Not sure why it didn't like this one.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.