tekartik / sembast.dart

Simple io database
BSD 2-Clause "Simplified" License
780 stars 64 forks source link

Filter.equals('clients.0.uid', uidClient)) does not work #343

Closed stephane-couget closed 1 year ago

stephane-couget commented 1 year ago

Good day ladies and gentlemen,

I have a store 'ooo' which has a field named 'customers' of type List.

I need to query store 'ooo' on a filter that compares customers[0].uid to a uidCustomer to find all rows in store 'ooo' for that customer to make a change on customers[0].address field .

I checked all sembast docs, asked MacGPT for advice but nothing works.

This code: final = Finder(filter: Filter.equals('customers.0.uid', uidCustomer)); does not make it possible to find the hundred lines concerned in the store 'ooo' (check by looking directly in the flat db file).

An idea ?

I'm on Flutter 3.3.7 / Dart 2.19.3 / sembast: ^3.3.1+1

Thank you for your attention

stephane-couget commented 1 year ago

Yes ! I found the answer on this web page 👍

https://github.com/tekartik/sembast.dart/issues/179

alextekartik commented 1 year ago

I like the syntax you proposed though so I added support for it in 3.4.1-0:

Filter.equals('customers.0.uid', uidCustomer)

should now work. You can even query for any item in the list using:

Filter.equals('customers.@.uid', uidCustomer)