I had to apply a tiny fix to Net::CouchDB as it was croaking with an error when attempting to submit new documents to a CouchDB 1.0 installation. The error message was

Unknown status code '415' while trying to operate on many documents. POST request to http://127.0.0.1:5984/db/_bulk_docs: Content-Type must be application/json

and the patch is trivial:

*** /tmp/DB.pm     2010-07-23 15:12:50.000000000 +0200
    --- /usr/lib/perl5/site_perl/5.8.5/Net/CouchDB/DB.pm    2010-07-23 15:09:07.000000000 +0200
    ***************
    *** 132,137 ****
    --- 132,138 ----
          }
          my $res = $self->request( 'POST', '_bulk_docs', {
              description => 'operate on many documents',
    +       headers =>  { content_type => 'application/json'}, # JPM
              content     => { docs => \@docs },
              201         => 'ok',
          });

Works nicely now.

Flattr this
Database, Perl, CouchDB, and NoSQL :: 23 Jul 2010 :: e-mail

Comments

blog comments powered by Disqus