Created
May 8, 2014 10:10
-
-
Save danse/9279018f53f6e5abe80a to your computer and use it in GitHub Desktop.
pouch experiment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="app/bower_components/pouchdb/dist/pouchdb-nightly.js"> | |
</script> | |
<script> | |
var reports; | |
function pad(data) { reports = data; } | |
</script> | |
<script src="reports.js"></script> | |
<script> | |
var db = new PouchDB('reports'); | |
reports.map(function(r) { db.post(r); }); | |
/* | |
db.allDocs({}, function(e, r) { | |
console.log(r.rows.length); | |
}); | |
*/ | |
function map(r) { | |
r.tags.forEach(function(t) { emit(t, null); }); | |
} | |
db.query({map:map, group:true, reduce:'count_'}); | |
</script> | |
</head> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment