Using MongoDB Node.js Driver to connect to an instance from the browser


I’ve read some key features about MongoDB stitch. I believe it allows us querying the MongoDB from the client’s browser using HTTP. However, I’m looking for an open source solution to connect to a MongoDB instance from my browser.

What is the current status of this? Is it possible to deploy an open source solution to connect to a MongoDB instance using HTTP or browserify?

Hi @Alex_Dunphy,

Welcome to MongoDB community!

MongoDB Realm js sdk should allow you to access your Atlas cluster via your web browser code.

However, with the use of package like webpack you might be able to use the MongoDB nodejs driver in your web code. Having said that its not recommended as Realm acts like a backend for those queries optimizing connection pools behind while using a driver directly might be insufficient. And expose security hazards…


Dear Pavel,

Thank you for your reply :slight_smile:
Yes, I understand the security implications but the service I’m building is not for the public and is for individual use. One user = One Database. With React, I believe that the page will not be refreshed and the connection can be kept running.

It is interesting to see if it’s possible to have a subset of the features of the MongoDB Driver working in the browser.

Are there any goals to provide a self-hosted version (open source) of MongoDB stitch? It would be similar to Hasura and Space Cloud.

Hi @Alex_Dunphy,

MongoDB Stitch is now called MongoDB realm.

Have you explored the possibility to use realm as local
Light wieght database without syncing it at all to Atlas

Just use it as your store