Find the path for a Realm file using Realm React Native for use with Realm Browser

On iOS, you can view the contents of the Realm database by opening the corresponding file using Realm Browser . The path to this file can be printed using the following line of code (as indicated here ):

print(Realm.Configuration.defaultConfiguration.path) 

Is it possible to do the same when using the Real source version of Realm?

+5
source share
2 answers

I just found the answer myself, digging out the docs :

 console.log('create db:', db.path) 
+9
source

Just in case, you cannot make the above work. Here is how I did it:

1) import the file in which you define the circuit, and create a new area in the component that will be mounted when the simulator is updated.

 import realm from './path_to_file_where_realm created' 

2) console.log (realm.path) in the componentWillMount () life cycle method and enable remote debugging to see the result.

3) open the real world browser and click on the open world file. The Shift G command on mac will let you paste the path from the .log console

click on a region file to open it using the region browser.

Also for those who are not familiar with the realm browser, it can be found here . It simply allows you to view and edit data in your area using a graphical interface.

+4
source

Source: https://habr.com/ru/post/1246772/


All Articles