db.createIndex(index [, callback])
Create an index if it doesn’t exist, or do nothing if it already exists.
pouchdb-find plugin needed: This API requires the pouchdb-find
plugin. See Mango queries for installation instructions.
Example Usage:
db.createIndex({
index: {
fields: ['foo']
}
}).then(function (result) {
// handle result
}).catch(function (err) {
console.log(err);
});
Example Response:
If the index was created, you’ll see:
{ "result": "created" }
Or if the index already exists:
<pre style='box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 15px; margin-top: 0px; margin-bottom: 12px; padd