Open hellomaya opened 6 years ago
I have found the solution to use DynamicRealm:
https://realm.io/docs/java/latest/#dynamic-realms
Thanks.
I have tried in java, and it's working well, and then I tried Realm objc framework, not success, also address the issue I have had to access Realm DB in native module by using Realm-Cocoa framework, and it appears, not supported this time. I am hoping one day, Realm JS can provide a way to access the db from Native Module also with Dynamic Realm ability, so it's able to move some of heavy computing code from JS to Native, then promoting the performance of the app, increasing flexibility of the Realm JS.
Thank your guys for this great library, in my practice with a production app with a lot statistics, it's running and performing pretty well, especially highly promoted the productivity than using Sqlite.
I will re-open this issue somehow waiting for update.
https://github.com/realm/realm-cocoa/issues/5233#issuecomment-322597215
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.
Got it! I am thinking to work around this by adding some code in current Realmjs native module by accessing db in objc, just like Realm-Cocoa do, I guess it's possible, as they used same core, well not sure for now, but totally support your team decision.
Hi @hellomaya Did you find a solution to use realm db on the native side?
Any news on this ?
I'm also really looking forward to this possibility.
Since React Native does not have an official way of processing background tasks on iOS, this job needs to be done in native code.
However, without access to the Realm in the native code, it is impossible to synchronize information, etc.
➤ Kenneth Geisshirt commented:
We haven't looked at recently.
any news on this topic?
Guys, please "thumb up" this issue to get the Realm team attention.
Goals
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:
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
React Native