How to use the pouchdb.default function in pouchdb

To help you get started, we’ve selected a few pouchdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github decentralized-identity / element / packages / element-lib / src / adapters / database / ElementPouchDBAdapter.js View on Github external
let PouchDB;

if (process.browser) {
  PouchDB = require('pouchdb').default;
  PouchDB.plugin(require('pouchdb-find').default);
  PouchDB.plugin(require('pouchdb-upsert'));
} else {
  PouchDB = require('pouchdb');
  PouchDB.plugin(require('pouchdb-find'));
  PouchDB.plugin(require('pouchdb-upsert'));
}

class ElementPouchDB {
  constructor({ name }) {
    this.dbName = name;
    this.db = new PouchDB(this.dbName);
    try {
      this.db.createIndex({
        index: { fields: ['type', 'anchorFileHash', 'operationHash', 'batchFileHash'] },
      });