How to use pouchdb-find - 6 common examples

To help you get started, we’ve selected a few pouchdb-find 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 readium / readium-desktop / src / main / di.ts View on Github external
if (!fs.existsSync(rootDbPath)) {
    fs.mkdirSync(rootDbPath);
}

// tslint:disable-next-line:no-var-requires
const pouchDbAdapter = require(__POUCHDB_ADAPTER_PACKAGE__);

// tslint:disable-next-line:no-var-requires
const pouchDbFind = require("pouchdb-find");

// tslint:disable-next-line:no-var-requires
const pouchDbSearch = require("pouchdb-quick-search");

// Load PouchDB plugins
PouchDB.plugin(pouchDbAdapter.default ? pouchDbAdapter.default : pouchDbAdapter);
PouchDB.plugin(pouchDbFind.default ? pouchDbFind.default : pouchDbFind);
PouchDB.plugin(pouchDbSearch.default ? pouchDbSearch.default : pouchDbSearch);

const dbOpts = {
    adapter: _POUCHDB_ADAPTER_NAME,
};

// Publication db
const publicationDb = new PouchDB(
    path.join(rootDbPath, "publication"),
    dbOpts,
);
const publicationRepository = new PublicationRepository(publicationDb);

// OPDS db
const opdsDb = new PouchDB(
    path.join(rootDbPath, "opds"),
github paperize / paperize / lib / services / pouch.js View on Github external
import PouchDB from 'pouchdb-core'

// All Environments
let configuredPouch = PouchDB
  .plugin(require('pouchdb-find').default)

if(process.env["NODE_ENV"] === 'test' && typeof window === 'undefined') {
  // Node tests, include extra libs for speed
  configuredPouch
    .plugin(require('pouchdb-adapter-memory').default)
  configuredPouch = configuredPouch.defaults({ adapter: 'memory' })
} else {
  // Any environment with a window
  configuredPouch
    .plugin(require('pouchdb-adapter-idb').default)
    .plugin(require('pouchdb-adapter-websql').default)
}

export default configuredPouch
github oknosoft / metadata.js / packages / metadata-pouchdb / index.js View on Github external
.plugin(require('pouchdb-adapter-http'))
    .plugin(require('pouchdb-replication'))
    .plugin(require('pouchdb-mapreduce'))
    .plugin(require('pouchdb-find'))
    .plugin(require('pouchdb-adapter-memory'));
}
else {
  if(window.PouchDB) {
    PouchDB = window.PouchDB;
  }
  else {
    PouchDB = window.PouchDB = require('pouchdb-core').default
      .plugin(require('pouchdb-adapter-http').default)
      .plugin(require('pouchdb-replication').default)
      .plugin(require('pouchdb-mapreduce').default)
      .plugin(require('pouchdb-find').default)
      .plugin(require('pouchdb-adapter-idb').default);
  }
}
var PouchDB$1 = PouchDB;

function adapter({AbstracrAdapter}) {
  const fieldsToDelete = '_id,search,timestamp'.split(',');
  return class AdapterPouch extends AbstracrAdapter {
    constructor($p) {
      super($p);
      this.props = {
        _data_loaded: false,
        _doc_ram_loading: false,
        _doc_ram_loaded: false,
        _auth: null,
        _suffix: '',
github oknosoft / metadata.js / packages / metadata-pouchdb / src / pouchdb.js View on Github external
.plugin(require('pouchdb-replication'))
    .plugin(require('pouchdb-mapreduce'))
    .plugin(require('pouchdb-find'))
    .plugin(require('pouchdb-adapter-memory'));
}
else {
  if(window.PouchDB) {
    PouchDB = window.PouchDB;
  }
  else {
    //const ua = (typeof navigator !== 'undefined' && navigator.userAgent) ? navigator.userAgent.toLowerCase() : '';
    PouchDB = window.PouchDB = require('pouchdb-core').default
      .plugin(require('pouchdb-adapter-http').default)
      .plugin(require('pouchdb-replication').default)
      .plugin(require('pouchdb-mapreduce').default)
      .plugin(require('pouchdb-find').default)
      .plugin(require('pouchdb-adapter-idb').default);
  }
}

export default PouchDB;
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'] },
      });
    } catch (e) {
github cdaringe / pouchy / src / index.js View on Github external
'use strict'

var bluebird = require('bluebird')
var path = require('path')
var adapterHttp = require('pouchdb-adapter-http')
var adapterFind = require('pouchdb-find')
var adapterReplication = require('pouchdb-replication')
var PouchDbCore = require('pouchdb-core')
var PouchDB = PouchDbCore.default || PouchDbCore
PouchDB.plugin(adapterHttp.default || adapterHttp)
  .plugin(adapterFind.default || adapterFind)
  .plugin(adapterReplication.default || adapterReplication)
PouchDB.utils = { promise: bluebird }
var privateMethods = require('./private')
var publicMethods = require('./public')

var assign = require('lodash/assign')
var isNil = require('lodash/isNil')
var toArray = require('lodash/toArray')

/**
 * @namespace
 * @property Pouchy.PouchDB
 * tap into the PouchDB constructor via Pouchy
 */

/**

pouchdb-find

Easy-to-use query language for PouchDB

Apache-2.0
Latest version published 5 months ago

Package Health Score

88 / 100
Full package analysis

Popular pouchdb-find functions