firestoreodm-flutter
firestoreodm-flutter copied to clipboard
Support collection groups
How can I do a collection group query with a sub-collection? It looks like right now I have to have a parent (collectionId) first and then get the sub-collection part of that collection. But I want to be able to query against all sub collection documents.
I have:
@Collection<Configuration>('configurations')
@Collection<SharedWith>('configurations/*/sharedWith')
final configurationRef = ConfigurationCollectionReference();
And I want to be able to query like I would if I had created a group query
final Query<Map<String, dynamic>> _configSharedWith = _firestore.collectionGroup('sharedWith');
// Query across all sub collection documents
final sharedWith = await _configSharedWith.where('userId', isEqualTo: userId).get();
Originally posted by @FXschwartz in https://github.com/firebase/flutterfire/discussions/7475#discussioncomment-3311361
Copied from https://github.com/firebase/flutterfire/issues/9751