node.js - 具有持久数据的NodeJS + RxDB + Electron

标签 node.js angular electron

我一直在玩PouchDB(使用express-pouchdb和pouchdb-find),意识到我需要通过Angular 5/Electron应用程序的Rxjs处理一些流。

对于当前的设置,我运行express-pouchdb来设置本地化的PouchDB以实现持久性,然后在Angular中,我有以下内容:

@Injectable()
export class PouchdbService {
    private _localdb = 'http://localhost:3000/main';
    private _pouchDb: any;

  constructor() {
    this._pouchDb = new PouchDB(this._localdb);
    PouchDB.plugin(PouchDBFind);

    this.createIndexes();
  }

  private createIndexes(): void {
    this._pouchDb.createIndex({
        index: {
            fields: [ 'tags' ]
        }
    });

    this._pouchDb.createIndex({
        index: {
            fields: [ 'date' ]
        }
    })

    this._pouchDb.createIndex({
        index: {
            fields: [ 'title' ]
        }
    });
  }

这通过_localdb属性为 express 应用程序提供了我的服务。我可以保留PouchDB express应用程序,并通过重写服务和重构代码通过RxDB对其进行调用。但是,我想我必须在每个集合上都调用sync

但是,如果有一种方法可以直接在RxDB上进行持久性运行,我宁愿删除快速应用程序。

最佳答案

我最终使用了websql adapter,它显然存储了应用程序加载和删除的express-pouchdb之间的信息。

关于node.js - 具有持久数据的NodeJS + RxDB + Electron,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47240857/

相关文章:

javascript - NodeJS : Getting the changes in a file indefinitely

node.js - 如何在 mongoose 中使用查询修饰符?

javascript - Node.js pg 池在第二次执行时速度缓慢

angular - 单击以删除/停用 Angular 2 中的辅助路线

javascript - 使用 vue-cli-service Electron :build 构建后的 Electron 空白屏幕

javascript - 无法将数据从 Node 服务器发送到ajax

Angular 服务测试 : Cannot find name 'asyncData'

angular - 在 Angular 4 中使用渲染器

带有 Facebook SDK 的 Electron 应用程序

angularjs - Angular Controller 中的 Electron IPC