Skip to content

Instantly share code, notes, and snippets.

@JeffML
Last active January 14, 2017 20:31
Show Gist options
  • Save JeffML/21ea85f8bbcce124e6ccfea7b31263a5 to your computer and use it in GitHub Desktop.
Save JeffML/21ea85f8bbcce124e6ccfea7b31263a5 to your computer and use it in GitHub Desktop.
const _ = require('lodash');
const hash = require('./hash');
const PouchDB = require('pouchdb');
const db = new PouchDB('choices');
db.allDocs({
include_docs: true
})
.then(docs => {
_.each(docs.rows, r => {
r.doc.key = hash(r.doc.choice);
db.put(r.doc);
});
})
.catch(e => {
console.error(e)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment