I'm trying to create an index on my data, but I keep getting this error. I've removed all permissions from the database temporary to get it work but still no success.
{
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'
}
My code:
(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']
});
})();
I've also tried installing pouchdb-authentication
and have successfully logged in using the code below, but I'm still unable to create indexes using the code above.
Auth code:
this.db.logIn('admin', 'password').then((x)=>{
console.log("This works");
}).catch(e=>console.log(e));
What should I try to get this working?