Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including pouchdb with all npm packages installed. Try it out:

// see documentation for more detail: http://pouchdb.com/api.html const PouchDB = require('pouchdb') require('pouchdb/extras/memory') /* this is used here just for compatibility with Tonic. you can omit this line and the {adapter: 'memory'} in the next, then your databases will be saved to disk or browser storage. */ // create a database (here with memory storage): const db = new PouchDB('test', {adapter: 'memory'}) // create a new doc with an _id of 'mydoc': let response = await db.put({ _id: 'mydoc', title: 'Heroes' }) // update an existing doc using _rev await db.put({ _id: 'mydoc', _rev: response.rev, title: "Sound and Vision", }) // later you can fetch your doc console.log(await db.get('mydoc')) // or add many more docs response = await db.bulkDocs([ {_id: 'myotherdoc', title: 'The Magisters', type: "fake band"}, {_id: 'another', title: 'Kowabunga', type: "fake band"}, {title: 'Without an _id', type: null} ]) console.log('bulkDocs response: ' + JSON.stringify(response, null, 2)) // and query them await db.put({ _id: '_design/fakebands', views: { fakebands: { map: (function (doc) { if (doc.type == "fake band") { emit(doc.title) } }).toString() } } }) await db.query('fakebands', {include_docs: true})

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

pouchdb v8.0.1

PouchDB is a pocket-sized database

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free