我正在使用带有 RxDB 7.3.2 和 pouchdb-adapter-idb 6.4.2 的 Angualr Cli 1.6.5(Angular 5.2.0)。
当我尝试创建/连接到数据库时,出现以下错误:
zone.js:192 Uncaught TypeError: winningRev is not a function
at insertDoc (index.es.js:370)
at nextDoc (index.es.js:449)
at eval (index.es.js:452)
at Map.forEach (<anonymous>)
at processDocs (index.es.js:426)
at idbProcessDocs (index.es.js:330)
at checkDone (index.es.js:354)
at IDBRequest.readMetadata [as __zone_symbol__ON_PROPERTYsuccess] (index.es.js:364)
at IDBRequest.wrapFn (zone.js:1166)
at ZoneDelegate.invokeTask (zone.js:421)
index-browser.es.js:486 Database has a global failure DOMException: Uncaught exception in event handler.
这是我从中调用的函数:
async getRxDB() {
this.rx_db = await RxDB.create({
name: 'testdb',
adapter: 'idb',
multiInstance: false
});
console.log(this.rx_db);
await this.rx_db.collection({name: 'fork', schema: TestDBSchema});
}
数据库架构:
const TestDBSchema = {
'title': 'test schema',
'version': 0,
'description': 'describes a simple task',
'type': 'object',
'properties': {
'name': {
'type': 'string',
'primary': true
}
}
};
我只是在一个组件中调用了这个函数:
constructor(private databaseService: DatabaseService) {}
ngOnInit() {
this.databaseService.getRxDB();
}
我在互联网上搜索过,但找不到类似的问题。有没有遇到类似设置的这个错误?
更新 @ lossleader提供的链接确实有效,谢谢