Using PouchDB with MongoDB

最后都变了- 提交于 2019-11-28 20:15:50

PouchDB contributor here. :) This is actually a question we get a lot, and it's understandable, given the popularity of MongoDB.

The short answer is: no, there's no way to get a PouchDB that you can just plug into your existing MongoDB database. You might want to try Meteor.js instead.

The long answer is that CouchDB and MongoDB are not equivalent, and in particular CouchDB is designed from the bottom-up to be used for synchronization. There's a good write-up by Jan Lenhardt that explains how it works. Part of the magic of PouchDB/CouchDB sync comes from this design, which Mongo does not have.

In fact, even if PouchDB used Mongo as a backend (which is not outside of the realm of possibility; we already support Redis and Riak), you would not be able to use your existing database as-is, since PouchDB would need to reconstruct this revision-handling schema over Mongo. Hence you would have to rewrite your app to use the PouchDB/CouchDB API.

Update: PouchDB will soon support a Mongo-like query language, via the pouchdb-find plugin.

I saw the minimongo project. I didn't try it yet. As far as I understand it's the same minimongo that is used in the meteor project. The project description says that it has server sync over http. But it doesn't have persistence, indexes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!