从移动应用程序进行pouchDB / couchDB复制的最佳实践

时间:2016-06-08 12:54:49

标签: angularjs mobile ionic-framework couchdb pouchdb

我在我的混合(Ionic)应用程序中使用pouchDB从我的Cloudant数据库发送和检索数据。

到目前为止我已经使用过continuous replication,但是交易太多而且服务器的账单正在上涨!

你能帮助我用#34;最佳实践和#34;重写我的代码吗?避免这个?

声明这样的远程URL是最好的实践,还是应该有数据库的本地副本?

正如您所看到的,我是pouchDB / couchDB的新手,我不了解如何正确管理复制。

感谢您的帮助!

.factory('usersDatabase', [
    'pouchDB',
    function (pouchDB) {
        'use strict';

        var usersDatabase = pouchDB('boaine_users'),
            remote = 'https://ididi:pwdpwd@myaccount.cloudant.com/boaine_users',
            opts = {
                live: true,
                retry: true
            };
        usersDatabase.replicate.to(remote, opts);
        usersDatabase.replicate.from(remote, opts);

        return usersDatabase;
    }
])

0 个答案:

没有答案