0

I am trying to make a peer to peer application and I want to query my local MongoDB data from chrome and send a response back to whoever initiated the request. What are my options? I can't store the data on a server else there's no point of calling it peer to peer. Also the data is already available in DB so I don't need to update the data just read it.

  • Can you elaborate a bit more on the application you are trying to build? Each client is going to host a mongoDB server locally? In that case maybe you’d like to look for some containered app where you can have both server and client together, like Electron? How will you establish the peer2peer connection? You can take a look here on how to query mongoDB directly using http https://mongodb-documentation.readthedocs.io/en/latest/ecosystem/tools/http-interfaces.html#gsc.tab=0 – CloudBalancing Dec 10 '20 at 09:04
  • yes actually I am using webRTC to establish connection between peers. A peer is gonna send a request and every peer is gonna send a reponse after querying their local DB. That's how I wanted it to function. – Suvid Sahay Dec 10 '20 at 09:13
  • In this case you will have to rethink of mongobd usage - or youll have to make your users installing it locally on their machine, then you can access it once it is running using http(s) request from the web. I thought Electron could be a good solution for you. But mongoDB cannot be bundled inside and electron app - i. This post there is an explanation on why and other possible solutions. https://stackoverflow.com/questions/51094968/embed-mongodb-with-electron. Another option is looking into other distributed DBs like https://github.com/orbitdb/orbit-db – CloudBalancing Dec 10 '20 at 09:26
  • Well for the time being I can work with installing it locally for every user. Just looking for ways to achieve this. – Suvid Sahay Dec 10 '20 at 09:40
  • Trying to achieve what? Installing the mongoDB on clients? Youll have to supply instructions on how to do so depending on the users Operating system. Or You take take a look at the previous link o attached on how yo ship an electron app bundled with a DB inside. If you are asking about how to wuery the DB from web. Take a look on the documentation in my first comment. You basicslly can generate an http request to the relevant DB port – CloudBalancing Dec 10 '20 at 09:46

0 Answers0