question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Realm query objects by array of ids

See original GitHub issue

Questions: I want to query by a list of ids but I get this error when I try to query by this:

byIds(ids: string[]) {
    return   this._realm
        .objects(Provider)
        .filtered('id IN $0',ids)
  }

The expression following ‘IN’ must be a keypath to a list

image

Version of Realm and Tooling

  • Realm JS SDK Version: 4.0.0-beta.0
  • Node or React Native: 0.61.5
  • Client OS & Version: Android
  • Which debugger for React Native: None

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
knethcommented, Aug 23, 2022

Next release (v10.20.0) will include an enhancement of the IN to support what os requested here.

1reaction
dridi93commented, Aug 25, 2022

Next release (v10.20.0) will include an enhancement of the IN to support what os requested here.

Hi @kneth,

First of All, thanks for this realease,

I have a question plz, what about ‘NOT IN’, how can i achieve this case ?

UPDATE

I use NOT id IN {1,2,3,4}, and it’s work!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Realm Swift - Find by IDs - Stack Overflow
Realm results contain unique objects so the easiest solution is to query for each dog and add the result to an array.
Read more >
Querying with Object ID vs Querying with array - MongoDB
I am migrating from another service and changing structure of the database a bit. I already have unique IDs attached to every data...
Read more >
Class: Collection - Realm
See: Array.prototype.entries ... Function to execute on each object in the collection. ... Query used to filter objects from the collection.
Read more >
Query all objects by array of Ids - Moralis Forum
I would like to run a query, where i know the object ids of the objects to return. I see there is a...
Read more >
[Solved]-Realm Swift - Find by IDs-swift - appsloveworld
Realm.objects().filter returns a list of "live", managed objects. It will not return duplicates because there is only one object matching the primary key....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found