Thursday 5 August 2021

Trying to connect to MongoDB using Realm

It's the first time I use Realm and MongoDB. I followed this good tutorial as starting point and I create this project.

https://codesandbox.io/s/realm-forked-mrjex?file=/src/state/DbModel.ts

Basically I used a sample DB of restaurants. In the tutorial, the author use the React context to save Db info like app, user and client but I prefer to setup a Mobx state tree. I think this is the only difference. Oh, and I use TypeScript (btw, what is the type of client? I didn't understand reading the guide, it seems MongoDB but from where need I to import it?).

My code doesn't work. I get nothing, still loading:

enter image description here

My app I think is stuck in Home component, in the getData() function because both client and user are null, but in App I created them and saved in my state so I don't understand what's going wrong..

EDIT: and sometimes, as Danila noted, I get also this error Cannot assign to read only property '_locationUrl' of object '#<App>'.



from Trying to connect to MongoDB using Realm

No comments:

Post a Comment