Skip to content

Commit

Permalink
1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
glynnbird committed Oct 31, 2019
1 parent d8145f4 commit e689afe
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bin/couchimport.bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const couchimport = require('../app.js')
const argv = require('../includes/args.js').parse()

// output selected options
const options = ['url', 'database', 'delimiter', 'transform', 'meta', 'buffer', 'parallelism', 'type', 'jsonpath', 'preview', 'ignorefields']
const options = ['url', 'database', 'delimiter', 'transform', 'meta', 'buffer', 'parallelism', 'type', 'jsonpath', 'preview', 'ignorefields', 'overwrite']
console.log('couchimport')
console.log('-----------')
for (const i in options) {
Expand Down
7 changes: 4 additions & 3 deletions includes/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ module.exports = function (couchURL, couchDatabase, bufferSize, parallelism, ign
keys.push(payload.docs[i]._id)
}
}
const existingData = await db.fetchRevs({ keys: keys })

const existingData = await db.fetch({ keys: keys })
// make lookup table between id-->rev
const lookup = {}
for (i in existingData.rows) {
if (existingData.rows[i].id) {
if (existingData.rows[i].id && !existingData.rows[i].value.deleted) {
lookup[existingData.rows[i].id] = existingData.rows[i].value.rev
}
}
Expand All @@ -62,6 +61,8 @@ module.exports = function (couchURL, couchDatabase, bufferSize, parallelism, ign
for (i in payload.docs) {
if (payload.docs[i]._id && lookup[payload.docs[i]._id]) {
payload.docs[i]._rev = lookup[payload.docs[i]._id]
} else {
delete payload.docs[i]._rev
}
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "couchimport",
"version": "1.4.0",
"version": "1.4.1",
"description": "CouchImport - command-line helper to bulk import/export data from CSV/TSV",
"repository": "https://github.com/glynnbird/couchimport.git",
"keywords": [
Expand Down

0 comments on commit e689afe

Please sign in to comment.