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

Support list comparison in RQL #755

Closed
nielsenko opened this issue Aug 12, 2022 · 5 comments · Fixed by #1346
Closed

Support list comparison in RQL #755

nielsenko opened this issue Aug 12, 2022 · 5 comments · Fixed by #1346
Assignees

Comments

@nielsenko
Copy link
Contributor

nielsenko commented Aug 12, 2022

As of realm-core v12.5.0 RQL supports list comparisons, but the Dart SDK does not handle list arguments. Example:

realm.query('list = $0', [[1,2,3]]);
@thipokch
Copy link

@nielsenko Are there any workaround for this?

@nielsenko
Copy link
Contributor Author

What predicate are you trying to use?

@thipokch
Copy link

I've tried this id IN { 1, 2, 3 } using string concat, but I'm unsure whether if this a way to go.

@nielsenko
Copy link
Contributor Author

@thipokch I just accidentally revisited this issue, and saw I didn't respond to your reply. I'm very sorry about this oversight.

First, IN is different from =. The first checks for inclusion, the second for equality. But you hit a similar problem.

Yes string concatenation is the needed for now, but it is important that you do it on the query string itself, and not in the args, ie:

final list = [1,2,3];
realm.query(id IN {${list.join(',')}};

not

realm.query('id IN {$0}', [list]); // <-- won't work
realm.query('id IN {$0}', [list.join(',')]); // <-- won't work either

@desistefanova
Copy link
Contributor

Query list arguments are now supported in Realm SDK 1.4.0

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 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

Successfully merging a pull request may close this issue.

3 participants