본문 바로가기
front-end/React Native

[RN] Realm Studio로 realm file 열기

by -제이리 2023. 1. 18.
728x90
320x100

https://www.mongodb.com/docs/realm/studio/install/

 

Install Realm Studio — Realm

If you want a file type that isn't listed here, such as a .zip file, view the release page for the version you want. You'll find a complete list of installers for each version.

www.mongodb.com

위 사이트로 들어가 Realm Studio를 설치한다.

 

 

아래처럼 코드를 작성하면 (참고 https://www.mongodb.com/docs/realm/studio/open-realm-file/)

// Get on-disk location of the default Realm
Realm.open({}).then(realm => {
    console.log("Realm is located at: " + realm.path);
});

 

 

터미널에 경로주소가 뜬다.

ios와 안드로이드 각각 다른 로그가 남게 되는데

첫줄은 ios의 .realm 경로이고 두번째줄은 andriod의 .realm경로다.

 

 

첫줄같은경우 open 을 앞에 입력하고 나머지 경로를 입력하면 자동으로 Realm 스튜디오가 실행이된다.  

open /Users/<사용자이름>/Library/Developer/CoreSimulator/Devices/A7E4894A-E293-4007-A2ED-95BE6C82EAF8/data/Containers/Data/Application/585A7909-4643-4889-834E-35244110F4A9/Documents/default.realm

 

두번째줄같은 경우는 좀 번거로운 방법으로 Realm studio를 열어야한다.

 

1. 안드로이드 스튜디오를 통해 연다.

2. 오른쪽 하단에 Device File Explorer를 클릭(없다면 View-Tool WIndows-Device File Explorer통해 열 수 있음) 

3. 로그에 적인 경로대로 폴더를 열면 defaul.realm 파일이 나오게 된다.

4. 우클릭으로 Save As를 하여 저장을 한후  Realm studio를 통해 열면 끝.

 

이 경우엔 실제 파일을 여는게 아니기 때문에 변경될때마다 새로 저장해서 열어봐야하고 realm studio에선 직접적으로 데이터를 변경할 수 없다.

 

 

 

참고한 사이트

https://stackoverflow.com/questions/59415568/how-can-i-get-my-realm-database-in-a-file-to-open-in-realm-studio

728x90
320x100

댓글