Closed msmietankopzu closed 3 years ago
@msmietankopzu Could you provide a example (dummy data) of one of the records in your collection? Should help making debugging the exact issue easier.
agenda and buttons are collections status could be "DELETED" or "PUBLISHED"
agenda
buttons
code "123123123" description "DESCRIPTION" image "LINK_TO_IMAGE" status "DELETED" title "DUMMY TITLE"
EDIT: when I use
_firestore
.collection(Event.COLLECTION_NAME)
.where(Event.FIELD_STATUS, isEqualTo: EventStatus.STATUS_PUBLISHED)
.where(FieldPath.documentId, whereIn: eventIds)
.snapshots(),
I get my event in results (its status is "PUBLISHED") but I should get it in mentioned case either. So problem is with condition "isNotEqualTo"
EDIT2: In other place I am calling
_firestore
.collection(Event.COLLECTION_NAME)
.where(Event.FIELD_STATUS, isNotEqualTo: EventStatus.STATUS_DELETED)
.where(Event.FIELD_CODE, isEqualTo: code)
.get()
and I'm getting my event without any problem.
I'm afraid that query isn't possible because it ultimately results in two inequality checks due to using the documentId
field as well as isNotEqualTo
. See this SO answer for further clarification. Although, we should probably throw an error before this query gets to native platforms and confirm with a test. Thanks for raising this issue, @msmietankopzu.
Bug report
Describe the bug Firestore is not returning data when in "where" conditions are mixed string (as a field) and FieldPath.documentId . In this case with 2 where conditions I'm getting an error:
With only one "where" condition I have no trouble to get expected document, no matter which one I persist (conditions are not excluding themselves).
Steps to reproduce
Steps to reproduce the behavior:
Expected behavior
It should return docs that fulfill both conditions.
Sample project
Additional context
eventIds is a valid list of document ids - this condition is working as aspected when first "where" condition is not present.
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
``` Doctor summary (to see all details, run flutter doctor -v): [β] Flutter (Channel stable, 2.0.6, on Mac OS X 10.15.6 19G2021 darwin-x64, locale pl-PL) [β] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [β] Xcode - develop for iOS and macOS [β] Chrome - develop for the web [β] Android Studio [β] Android Studio (version 4.2) [β] IntelliJ IDEA Ultimate Edition (version 2019.2.2) [β] Proxy Configuration [β] Connected device (2 available) β’ No issues found! ```Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
``` Dart SDK 2.12.3 Flutter SDK 2.0.6 event_app 0.0.35+35 dependencies: - cached_network_image 3.0.0 [flutter flutter_cache_manager octo_image] - cloud_firestore 2.1.0 [cloud_firestore_platform_interface cloud_firestore_web firebase_core firebase_core_platform_interface flutter meta] - firebase_auth 1.1.4 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 1.1.1 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 2.0.3 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_storage 8.0.6 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine] - flutter_spinkit 5.0.0 [flutter] - fluttertoast 8.0.6 [flutter flutter_web_plugins] - provider 5.0.0 [collection flutter nested] - qr_code_scanner 0.4.0 [flutter] - smooth_page_indicator 0.3.0-nullsafety.0 [flutter] - url_launcher 6.0.3 [flutter url_launcher_platform_interface url_launcher_linux url_launcher_macos url_launcher_windows url_launcher_web] dev dependencies: - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data] transitive dependencies: - archive 3.1.2 [crypto path] - async 2.5.0 [collection] - boolean_selector 2.1.0 [source_span string_scanner] - characters 1.1.0 - charcode 1.2.0 - clock 1.1.0 - cloud_firestore_platform_interface 5.0.1 [collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 2.0.1 [cloud_firestore_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - collection 1.15.0 - crypto 3.0.1 [collection typed_data] - fake_async 1.2.0 [clock collection] - ffi 1.0.0 - file 6.1.1 [meta path] - firebase_auth_platform_interface 4.2.2 [firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 1.1.2 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta] - firebase_core_platform_interface 4.0.1 [collection flutter meta plugin_platform_interface] - firebase_core_web 1.0.3 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_crashlytics_platform_interface 3.0.3 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_platform_interface 2.0.4 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 1.0.6 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta] - flutter_blurhash 0.6.0 [flutter meta pedantic] - flutter_cache_manager 3.0.2 [clock collection file flutter http image path path_provider pedantic rxdart sqflite uuid] - flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math] - http 0.13.3 [async http_parser meta path pedantic] - http_parser 4.0.0 [charcode collection source_span string_scanner typed_data] - image 3.0.2 [archive meta xml] - intl 0.17.0 [clock path] - js 0.6.3 - matcher 0.12.10 [stack_trace] - meta 1.3.0 - nested 1.0.0 [flutter] - octo_image 1.0.0+1 [flutter flutter_blurhash] - path 1.8.0 - path_provider 2.0.1 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows] - path_provider_linux 2.0.0 [path xdg_directories path_provider_platform_interface flutter] - path_provider_macos 2.0.0 [flutter] - path_provider_platform_interface 2.0.1 [flutter meta platform plugin_platform_interface] - path_provider_windows 2.0.1 [path_provider_platform_interface meta path flutter ffi win32] - pedantic 1.11.0 - petitparser 4.1.0 [meta] - platform 3.0.0 - plugin_platform_interface 2.0.0 [meta] - process 4.2.1 [file path platform] - rxdart 0.27.0 - sky_engine 0.0.99 - source_span 1.8.0 [charcode collection path term_glyph] - sqflite 2.0.0+3 [flutter sqflite_common path] - sqflite_common 2.0.0+2 [synchronized path meta] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - string_scanner 1.1.0 [charcode source_span] - synchronized 3.0.0 - term_glyph 1.2.0 - test_api 0.2.19 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher] - typed_data 1.3.0 [collection] - url_launcher_linux 2.0.0 [flutter] - url_launcher_macos 2.0.0 [flutter] - url_launcher_platform_interface 2.0.2 [flutter plugin_platform_interface] - url_launcher_web 2.0.0 [url_launcher_platform_interface meta flutter flutter_web_plugins] - url_launcher_windows 2.0.0 [flutter] - uuid 3.0.4 [crypto] - vector_math 2.1.0 - win32 2.0.5 [ffi] - xdg_directories 0.2.0 [meta path process] - xml 5.1.0 [collection meta petitparser] ```