Skip to content

Instantly share code, notes, and snippets.

@danse
Created May 8, 2014 10:10
Show Gist options
  • Save danse/9279018f53f6e5abe80a to your computer and use it in GitHub Desktop.
Save danse/9279018f53f6e5abe80a to your computer and use it in GitHub Desktop.
pouch experiment
<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