Last active
January 14, 2017 20:31
-
-
Save JeffML/21ea85f8bbcce124e6ccfea7b31263a5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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