Skip to content

Instantly share code, notes, and snippets.

var expressPouchDB = require('express-pouchdb');
expressPouchDB.setBackend(require('memdown'));
app.use(expressPouchDB);
var pouch = expressPouchDB.getPouchDB('dbname');
var expressPouchDB = require('express-pouchdb')(require('pouchdb'));
expressPouchDB.setBackend(require('memdown'));
app.use(expressPouchDB);
var pouch = expressPouchDB.getPouchDB('dbname');
@nolanlawson
nolanlawson / pouchdb_defaults.txt
Created May 28, 2014 21:48
IRC discussion on PouchDB defaults
12:52 PM <daleharvey> nolanlawson: we cant have express-pouchdb depend on pouchdb, thats broken
12:52 PM <daleharvey> pouchdb-server should depend on pouchdb
12:55 PM ⇐ ncthom91 quit ([email protected]) Ping timeout: 264 seconds
12:56 PM <nolanlawson> daleharvey: hm, yeah, that wouldn't be so bad
12:56 PM <nolanlawson> Less duplicated config in express and server
12:57 PM <nolanlawson> However gets weird with all the places Pouch is instantiated, e.g. all-dbs
12:57 PM <nolanlawson> Would require your default constructor configuration
12:58 PM <nolanlawson> I see where you're coming from
12:58 PM <daleharvey> nolanlawson: yup, but its not just like a nice to have, it currently makes pouchdb-express pretty much useless outside of pouchdb-server
12:59 PM <nolanlawson> Why
<html>
<body>
<script src="//cdn.jsdelivr.net/pouchdb/2.2.3/pouchdb.js"></script>
<script src="index.js"></script>
</body>
</html>
<html>
<body>
<script src="pouch.js"></script>
<script src="index.js"></script>
</body>
</html>
/**
* @license AngularJS v1.3.0-beta.7
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, document, undefined) {'use strict';
/**
* @description
*
@nolanlawson
nolanlawson / _sorted_by_frequency
Last active August 29, 2015 14:02
Output from the persisted-views performance test when using the WebSQL adapter and debug-websql
sql statements sorted from most to least frequent:
7256 SELECT seq FROM 'by-sequence' WHERE doc_id_rev=?
7256 SELECT json FROM 'document-store' WHERE id = ?
7256 INSERT INTO 'by-sequence' (doc_id_rev, json, deleted) VALUES (?, ?, ?);
4896 SELECT json AS metadata FROM 'document-store' WHERE id = ?
2562 SELECT 'by-sequence'.seq AS seq, 'by-sequence'.deleted AS deleted, 'by-sequence'.json AS data, 'document-store'.json AS metadata FROM 'document-store' JOIN 'by-sequence' ON 'by-sequence'.seq = 'document-store'.winningseq WHERE 'document-store'.id=?
258 SELECT update_seq FROM 'metadata-store'
100 SELECT 'by-sequence'.seq AS seq, 'by-sequence'.deleted AS deleted, 'by-sequence'.json AS data, 'document-store'.json AS metadata FROM 'document-store' JOIN 'by-sequence' ON 'by-sequence'.seq = 'document-store'.winningseq WHERE 'document-store'.local = 0 AND 'document-store'.id >= ? AND 'by-sequence'.deleted = 0 ORDER BY 'document-store'.id ASC LIMIT 5 OFFSET 0
52 SELECT COUNT('document-store'.id) AS 'num' FROM 'document
@nolanlawson
nolanlawson / app.js
Last active August 29, 2015 14:02
Quick test of pouchdb in node-webkit
(function() {
'use strict';
var db = null;
var dbname = 'idb://pouch_intro';
window.addEventListener( 'load', loadPouch, false );
function loadPouch() {
new PouchDB(dbname, function(err, pouchdb){
<!DOCTYPE html>
<html>
<head>
<title>PouchDB #2342</title>
<script src="pouch.js"></script>
<script src="main.js"></script>
</head>
<body>
</body>