【发布时间】:2020-09-01 19:06:58
【问题描述】:
我正在尝试为我的数据创建索引,但我不断收到此错误。我已经暂时从数据库中删除了所有权限以使其正常工作,但仍然没有成功。
{
error: 'error_saving_ddoc',
reason: 'Unknown error while saving the design document: unauthorized',
ref: 612684199,
status: 500,
name: 'error_saving_ddoc',
message: 'Unknown error while saving the design document: unauthorized'
}
我的代码:
(async () => {
let db:any = new PouchDB('http://localhost:5984/test', { skip_setup: true });
await db.createIndex({
index: {fields: ['area']}
})
let res = await db.find({
selector: {'area': {$gt: null}},
fields: ['_id', 'area'],
sort: ['_id']
});
})();
我也尝试安装pouchdb-authentication并使用下面的代码成功登录,但我仍然无法使用上面的代码创建索引。
授权码:
this.db.logIn('admin', 'password').then((x)=>{
console.log("This works");
}).catch(e=>console.log(e));
我应该怎么做才能让它工作?
【问题讨论】:
标签: couchdb pouchdb couchdb-futon