Issue with Realm Web SDK

I am unable to access data using the Realm Web SDK.

This particular line is throwing error

My browser gives an error “Cannot read property ‘mongodb’ of undefined”

I checked that “app” is correct and that I am able to successfully authenticate as well

@Salman_Alam I suspect you’re using the recently released 1.0.0-rc.1 version of Realm Web, which introduced a breaking change to the API: The mongodb client should be accessed via

const mongo = user.mongoClient("<atlas service name>");

Do you mind sharing a link to the tutorial that you’re following?

Hi I am just coming back to this again after quite a while and almost made the same post. This is the main tutorial on MongoDB Realm docs under “Web SDK”.

Here is the link:

1 Like

Hi Salman,

We (still) have an issue on tutorial and I’ve forwarded a request to get this updated as soon as possible.
I see you also posed Realm Web SDK & VueJS - which refers to the same underlying issue.

Did you try my suggestion on getting the MongoDB Client from the user object instead of the app?

Hey @kraenhansen. Yes! Thank you so much! I wasted 2 hours trying to figure out what is wrong then I came back to check this old issue.

Yes, please if you can somehow elevate that request to keep the docs for Realm Web SDK and Nodejs SDK to be up to date.

We have a production app on Stitch legacy SDK, we thought when Realm first came out we should start migrating however back then I encountered similar issues. I thought by this time the docs should be up to date and all the gaps will be sorted out.

It’s quite disheartening seeing that hasn’t happened yet :frowning: :frowning_face:

Thank you so much nonetheless!