Showing posts with label couchdb. Show all posts
Showing posts with label couchdb. Show all posts

Friday, October 24, 2014

Couchdb Filter Replication Error: "changes_reader_died" Debugged

Couchdb replication allows for filtering. It produces a nondescript error of "changes_reader_died" with endless attempts at replication. The error is a result of a poorly named query key (parameter).

This can be seen when a document in the _replicator database contains the following. The query key is set to "key".

"query_params": {
    "key": "user"
  }
}

You may have to delete your _replicator database to stop the replication loop even with "continuous": false.


The solution was to change the key from "key" to another label. In the example below it is changed to "mailbox".


"query_params": {
    "mailbox": "user"
  }
}

With this change the dreaded "error" :"changes_reader_died" was debugged and I could relax.

Friday, June 01, 2012

415 unsupported media type couchdb jquery

Hate it when I repeat a mistake. Worse when I repeat it.

Adding a new record to couchdb requires a POST and jQuery supports that verb. So I did the simple
    $.post(toc.dbUrl+'techtocs', data, function(data) {
        alert("Data Loaded: " + data);
    },"json");

But this got me the "415 unsupported media type" error. I was sending application/json type but I still got the error. So I finally looked up my old code and did this:
$.ajax({
        type: 'POST',
        dataType: 'json',
 contentType: "application/json",
 data: JSON.stringify(data),
 url: toc.dbUrl+'techtocs',
 success: function(sdata){
     //stuff here+ 
        }
    });

Glad to get it working on this project where techtocs is the database name.