Regarding Hybrid Application Development

263 Views Asked by At

I have built an android application on ionic . At the backend I'm using node, express, socketIO & MongoDB...

I have purchased an Ubuntu base server and installed pm2 and started mongodb and node...

Everything is working perfectly well.

My Question is :

  • I'am searching for a local db which have perfect sync options with mongo

The one that i found interesting is lokijs & PouchDB ..

  • Now lokijs being a faster option but sync with mongo is a problem

  • On the other Hand Pouch DB sync with ease with Couch DB [ i choose mongo over couch is because that we can't create collections - tables in couch ]

I just need the best solution for local database

1

There are 1 best solutions below

0
On

You can try indexedDb. It stores data the "same" style as mongodb. You can stream your docs from mongodb with socket.io to your client app and instantly store them to the indexeddb without any modification.

They work pretty well with each other. Both mongodb and indexeddb has the same structure. Database is a database in both. Collection equals to objectstore in indexeddb. Document is a javascript object in indexeddb.

But there is two problems with indexeddb. Its insertion speed is slow. Not extramely slow but its supresingly slow. The other problem is the api is bit of a mess but indexeddb is around for a while so you will find answers for your qustions all around the web.

Docs: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API