gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 12:35:51 25 4
gpt4 key购买 nike

我一直在玩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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com