small medium large xlarge

21 Nov 2013, 03:03
Kevin Lindsey (1 post)

I installed couchdb 1.5.0 via brew on OS X 10.9. When I try to run import-books.js I get a long string of the following:

409 { error: 'conflict', reason: 'Document update conflict.' }

From what I can tell, nothing is getting in. For example, here’s the output from “./dbcli /books” after letting import-books.js run for a bit:

200 { db_name: 'books',
  doc_count: 1,
  doc_del_count: 0,
  update_seq: 1,
  purge_seq: 0,
  compact_running: false,
  disk_size: 4185,
  data_size: 255,
  instance_start_time: '1385002847258529',
  disk_format_version: 6,
  committed_update_seq: 1 }

I verified the JSON generated from the RDF parser and that looks good. I’m not familiar with CouchDB. Any suggestions on how to get around these errors?

22 Nov 2013, 19:39
Jim R. Wilson (106 posts)

CouchDB is one of my favorite databases because it’s very RESTful. In this case, the 409 is telling you that there’s a conflict trying to insert/update the documents.

What’s probably happening is you’ve run the import before, so those documents already exist. When you run the script again, it tries to PUT the document, but doesn’t include the previous revision ID.

CouchDB’s 409 is telling you that it’s rejecting the PUT because your view of the document (that it doesn’t exist) conflicts with the databases’s view of the document (that it does already exist).

A simple way to solve this would be to drop the database and recreate it.

$ ./dbcli.js DELETE books
200 { ok: true }
$ ./dbcli.js PUT books
201 { ok: true }

After that, you shouldn’t see 409’s any more. Hope this helps!!

Selfie on 5-6-14 at 11.30 pm s_pragsmall
23 May 2014, 05:26
Aniket Suryavanshi (7 posts)

Thanks Jim, the above steps helped to overcome the 409 error.

When tried to run again node –harmony import-books.js, I got the following error:

/Users/aniket/projects/learning/nodejs/jim-wilson/databases/import-books.js:21 url: ‘http://localhost:5984/books/’ + doc._id, ^ TypeError: Cannot read property ‘_id’ of undefined at /Users/aniket/projects/learning/nodejs/jim-wilson/databases/import-books.js:21:50 at /Users/aniket/projects/learning/nodejs/jim-wilson/databases/lib/rdf-parser.js:16:23 at fs.js:207:20 at Object.oncomplete (fs.js:107:15)

Any idea how can I overcome this?

26 May 2014, 11:04
Jim R. Wilson (106 posts)

Does the list-books-queued.js program work as expected?

You must be logged in to comment