atn832 / fake_cloud_firestore

BSD 2-Clause "Simplified" License
119 stars 93 forks source link

StreamSubscription<QuerySnapshot<Map<String, dynamic>>> fails to capture data if the query is filtered using .where(field, arrayContains: Map<String, String>) #279

Open tannerhenry1 opened 11 months ago

tannerhenry1 commented 11 months ago

Below is the minimum reproducible code for this issue:

final mockDb = FakeFirebaseFirestore();
final mockCollectionRef = mockDb.collection('someCollection');
await mockCollectionRef.add({
        'users': [{'some_field': 'mockFieldValue', 'some_other_field': 'mockFieldValue2'}],
 });
mockCollectionRef
          .where(
            'users',
            arrayContains: {
              'some_field': 'mockFieldValue',
              'some_other_field': 'mockFieldValue2'
            },
          )
          .snapshots()
          .listen((event) {
            log.i('Listener found: ${event.docs.length}');
          });

The console indicates that there are no documents associated with this listener request, i.e. the log,i statement prints 0.