How to use the pouchdb-core.plugin function in pouchdb-core

To help you get started, we’ve selected a few pouchdb-core 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 jrs-innovation-center / tcvsn-pwa / api / load-indexes.js View on Github external
const PouchDB = require('pouchdb-core')

const db = new PouchDB('data', { adapter: 'mysql' })

// sort the docs by the type property
  .createIndex({ index: { fields: ['type'] } })
  .then(() => {
    console.log('Created an index on the type field.')
  .catch(err => console.log(err))

// sort the docs by the name property
  .createIndex({ index: { fields: ['name'] } })
  .then(() => {
github TankerHQ / quickstart-examples / client / nodejs / hello-world / persistence.js View on Github external
const fs = require('fs');
const PouchDBCore = require('pouchdb-core');
const PouchDBAdapterLevel = require('pouchdb-adapter-leveldb');
const PouchDBFind = require('pouchdb-find');

const tankerConfig = require('./config');


// Custom setup to persist data with PouchDB in Node.js (not needed when
// using the tanker SDK in a browser application).
module.exports = {
  config: {
    PouchDB: function (dbName) {
      // Folder to store tokens for this trustchain
      const folder = `./data/${tankerConfig.trustchainId.replace(/[\/\\]/g, '_')}`;

      // Ensure folder exists
      if (!fs.existsSync(folder)) {

      // Apply defaults
      const PouchDB = PouchDBCore.defaults({ adapter: 'leveldb' });
github apache / couchdb-fauxton / app / addons / documents / rev-browser / actions.js View on Github external
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.

import FauxtonAPI from "../../../core/api";
import {post} from "../../../core/ajax";
import ActionTypes from "./actiontypes";
import getTree from "visualize-rev-tree/lib/getTree";
import PouchDB from "pouchdb-core";
import PouchHttpAdapter from 'pouchdb-adapter-http';

let db;

export const initDiffEditor = (dbName, docId) => dispatch => {
  // We have to use API url here because PouchDB doesn't take relative urls.
  const url = FauxtonAPI.urls('databaseBaseURL', 'apiurl', dbName);
  db = PouchDB(url);

  Promise.all([db.get(docId), getTree(db, docId)])
    .then(([doc, tree]) => {
      const conflictingRevs = getConflictingRevs(tree.paths, tree.winner, Object.keys(tree.deleted));
      const initialRev = conflictingRevs[0];

      if (!initialRev) {
        return dispatch(treeLoaded(tree, doc, conflictingRevs, null, dbName));
github nolanlawson / / src / js / worker / pouchdb.js View on Github external
// custom version of pouchdb cutting out stuff we don't need

import PouchDB from 'pouchdb-core';
import idb from 'pouchdb-adapter-idb';
import websql from 'pouchdb-adapter-websql';
import http from 'pouchdb-adapter-http';
import upsert from 'pouchdb-upsert';
import load from 'pouchdb-load';

export default PouchDB
github paperize / paperize / lib / services / pouch.js View on Github external
import PouchDB from 'pouchdb-core'

// All Environments
let configuredPouch = PouchDB

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

export default configuredPouch
github neighbourhoodie / voice-of-interconnect / bin / couch-doctor.js View on Github external
const url = require('url')

const PouchDB = require('pouchdb-core')
const SpeechToTextV1 = require('watson-developer-cloud/speech-to-text/v1')
const NaturalLanguageUnderstandingV1 = require('watson-developer-cloud/natural-language-understanding/v1.js')
const stream = require('stream')
const ffmpeg = require('fluent-ffmpeg')

const [couchUrl, dbName] = process.argv.slice(2)
const {
} = process.env

if (!couchUrl) {
  console.log('Usage: node bin/couch-doctor.js [dbName]')
github pouchdb / pouchdb / packages / node_modules / pouchdb-browser / src / index.js View on Github external
import PouchDB from 'pouchdb-core';

import IDBPouch from 'pouchdb-adapter-idb';
import HttpPouch from 'pouchdb-adapter-http';
import mapreduce from 'pouchdb-mapreduce';
import replication from 'pouchdb-replication';


export default PouchDB;
github fiatjaf / pf / core / db.js View on Github external
const path = require('path')
const PouchDB = require('pouchdb-core')

const file = path.join(process.cwd(), '_database')

module.exports = new PouchDB(file)
github stockulus / pouchdb-react-native / packages / pouchdb-react-native / index.js View on Github external
'use strict'

import PouchDB from 'pouchdb-core'
import AsyncStoragePouch from 'pouchdb-adapter-asyncstorage'
import HttpPouch from 'pouchdb-adapter-http'
import mapreduce from 'pouchdb-mapreduce'
import replication from 'pouchdb-replication'


export default PouchDB
github will-adkins / Tri-Track / api / load-data.js View on Github external

const PouchDB = require('pouchdb-core')


const db = new PouchDB(`${COUCHDB_SERVER}${COUCHDB_DBNAME}`)

const data = [
    _id: 'workout_john-smith_2018-07-26T07:40:23Z',
    dateTime: '2018-07-26T07:40:23Z',
    profileId: 'profile_john-smith',
    type: 'workout',
    category: 'Run',
    distanceMi: 5,
    durationSec: 900,
    motivation: 1,


The core of PouchDB as a standalone package.

Latest version published 1 year ago

Package Health Score

81 / 100
Full package analysis

Similar packages