-
Notifications
You must be signed in to change notification settings - Fork 577
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 IN queries #450
Comments
At some point we will support a syntax for this type of query. Something like: let filtered = sample.filtered('id IN [2, 4, 7, 10]') Unfortunately we don't yet support this so for now you will have to generate a query to do this yourself. |
Here is a code snippet that should generate the query you want to run: var filtered = sample.filtered([2,4,7,10].map((id) => 'id == ' + id).join(' OR ')); This should create a query of the form |
Thank you. It works with |
Leaving this open until we add |
Looking forward to see |
@alazier Do you have roadmap for this feature yet? |
@dzuncoi There are a number of query tasks we want to look into and hopefully soon, but no timeline yet, sorry. |
@kristiandupont No problem, just want to know the timeline, I'm still fine with current query syntax :) |
My collection contains strings, which I'd like to quote while building the query. Didn't find a quote() function. Is there one ? |
@alazier Hello, sample.filtered('Id == $0', someVariable) To an array? |
Any updates for supporting |
@donni106 import RealmQuery from 'realm-query';
let items = RealmQuery
.where(realm.objects('superlist'))
.in('Id', ids) //ids here being an array
.findAll(); |
Any update on IN operator? |
Tracked in realm/realm-core#2978 |
Is it possible to make aggregation(joins) between two collections in realm Database? |
Let's say I have the following
sample
data:When I execute the following:
it returns one
Results
object with 5 filtered values like this:However, my question is how I can filter random ids? For example, I want to filter ids of 2, 4, 7, and 10.
What I can think of is:
But the problem here is it returns an array of 4
Results
objects, not the singleResults
object.Is it possible to get the results like the
filtered1
in the second case?The text was updated successfully, but these errors were encountered: