21 Nov 2013, 03:03
Kevin_-_head_shot_-_192x192_pragsmall

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
Avatar_pragsmall

Jim R. Wilson (43 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!!

  You must be logged in to comment