是否可以将两个不同的数据库用于脱机Web应用程序

是否可以将两个不同的数据库用于脱机Web应用程序

问题描述:

我有一个Web应用程序,当前使用postgres数据库。但是我也想使我的应用程序也可以脱机工作。我发现CouchDB / PouchDB支持Web应用程序的脱机。但是它说我必须在现有后端中使用CouchDB而不是postgres。

I have a web application which currently uses postgres database. But I would like to make my application work in offline too. I found that CouchDB/PouchDB supports offline for web applications. But it says I have to use CouchDB in my existing backend instead of postgres.

我想知道是否可以在不更改现有postgres的情况下在Web应用程序中实现CouchDB数据库?

I would like to know is it possible to implement CouchDB in web app without changing the existing postgres database?

是否需要将postgres数据库更改为benchDB才能实现此功能?

Do I need to change the postgres database to couchDB to implement this feature?

至少在理论上可以做到这一点。而且我当然还没有在这方面做任何工作,因此我无法为您提供实施建议。但是PouchDb确实支持 LevelUp 作为PouchDb服务器的后端(我不确定这是否也适用于PouchDb客户端)。

It is possible to do this - at least in theory. And I have certainly not done any work in this area yet so I cannot advise you on how to implement it. But PouchDb does support LevelUp as a backend to the PouchDb Server (I am not sure if this also applies to the PouchDb client).

这意味着您可以将PouchDb用于离线Web应用程序并将数据同步到PouchDb Server,但可以使用LevelUp功能将PostGres SQL用作PouchDb Server存储服务。

This means that you could use PouchDb for your offline web application and sync data to the PouchDb Server, but use the LevelUp capability to use PostGres SQL as the PouchDb Server storage service.

诺兰·劳森(Nolan Lawson)有一篇很好的文章,题为 PouchDb升级,描述了此功能此处

There is a good article by Nolan Lawson entitled "PouchDb levels up" that describes this capability here.