Access the db in native module
See original GitHub issueGoals
When I have a lot data in Realm DB, and I need to do some statistics on them, for example, SUM them all, this time, doing this at javascript become pretty slow, looks like UI is frozen. So I am thinking, is it possible to access Realm DB in a native module and then doing this data processing there?
Expected Results
I am expecting that the Realm could support this, as I can access the Realm default db at native module, and then I found that’s not connivence.
Actual Results
In Android scenario, the java API from Realm docs, provide way to access the data, but it required defined Model to access, like this:
public class Person extends RealmObject {
private String id;
private String name;
private RealmList<Dog> dogs;
// getters and setters
}
realm.where(Person.class)
.equalTo("dogs.color", "Brown")
.findAll();
So now the problem is, the Realm Schema already defined in javascript, then if I was going to write a certain native module to access the db at Java, I will have to define them all in Java too, and then try to query the data.
So is it possible to have some API to query the db directly by using schema name too? Just like it was in javascript, Realm.objects(schemaName)...
Steps to Reproduce
Code Sample
Version of Realm and Tooling
-
Realm JS SDK Version: ?
-
Node or React Nattive: ?
-
Client OS & Version: ?
-
Which debugger for React Native: ?/None
-
Realm JS 1.10.1
-
Realm Java 3.5.0
-
React Native
-
Android Version 5.1.1
React Native
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:10 (1 by maintainers)

Top Related StackOverflow Question
Guys, please “thumb up” this issue to get the Realm team attention.
Thank you for your input. I see the use case but as Mark points out, it will be difficult to make it work not just initially but continuously as you will have to make sure that the cocoa and js versions of Realm use the same version of the Realm core. As we don’t (currently, maybe that will change) have synchronized release schedules, upgrading the Realm library will be a tedious process.