You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
455 B
28 lines
455 B
import PouchDB from 'pouchdb'
|
|
import PouchDBfind from 'pouchdb-find'
|
|
|
|
// adding plugin for index
|
|
PouchDB.plugin(PouchDBfind)
|
|
|
|
// create database
|
|
const pouchdb = new PouchDB('./../storage/database', {
|
|
revs_limit: 5
|
|
})
|
|
|
|
// create fields for index
|
|
const fields = [
|
|
'type',
|
|
'name'
|
|
]
|
|
|
|
// adding index
|
|
try {
|
|
await pouchdb.db.createIndex({
|
|
index: {
|
|
fields: fields
|
|
}
|
|
})
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|