Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query for a dictionary key inside a collection of mixed doesn't find matches #7282

Closed
nirinchev opened this issue Jan 23, 2024 · 1 comment
Closed
Assignees

Comments

@nirinchev
Copy link
Member

I have the following test case:

realm.write(() {
  first = realm.add(AnythingGoes(
      oneAny: RealmValue.from([
    1,
    'a',
    {'foo': 'bar'}
  ])));

  second = realm.add(AnythingGoes(
      oneAny: RealmValue.from([
    2,
    {'foo': 'baz'}
  ])));

  third = realm.add(AnythingGoes(
      oneAny: RealmValue.from([
    3,
    'c',
    {
      'foo': {'child': 5},
      'bar': 10
    },
    3.4
  ])));
});

final dictionaryInListQuery = realm.query<AnythingGoes>("oneAny[*].foo BEGINSWITH 'ba'");
expect(dictionaryInListQuery, unorderedMatches([first, second]));

oneAny is a mixed property and I create 3 objects where oneAny contains a list and one of the elements in the list is a dictionary that has the key foo. Two of the objects have values for foo that start with ba, so I expect the query to find them, but it returns an empty collection. Is my query wrong or is there a bug with the implementation of queries that traverse collections in mixed? Based on this document, it appears like this type of query is supported.

@jedelbo
Copy link
Contributor

jedelbo commented Feb 6, 2024

Fixed by #7315

@jedelbo jedelbo closed this as completed Feb 6, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants