apache / nano

Nano is now part of Apache CouchDB. Repo moved to https://GitHub.com/apache/couchdb-nano

Home Page:https://github.com/apache/couchdb-nano

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`multipart.insert` not working when doc `name` is not specified

patriciagarcia opened this issue · comments

Hi,

creating a doc with attachments without specifying an _id for the doc (example below) is failing for me:

alice.multipart.insert({ foo: 'bar' }, [{name: 'rabbit.png', data: data, content_type: 'image/png'}], function(err, body) {
        if (!err)
          console.log(body);
    });

I don't see any error, just the doc is not created in the database, but everything goes fine when I specify a doc name, as in here:

alice.multipart.insert({ foo: 'bar' }, [{name: 'rabbit.png', data: data, content_type: 'image/png'}], 'mydoc', function(err, body) {
        if (!err)
          console.log(body);
    });

According to the documentation params is optional.

This might be a bug? Or am I doing something wrong?

Thanks!

Hi @patriciagarcia, this indeed looks like a bug. Thanks for reporting!

Currently only PUT /{db}/{docid} with multipart/related is supported in CouchDB.
There is a JIRA ticket demanding the POST.

Maybe nano could support the desired behaviour? Then we would need to feature detect it for upcoming CouchDB releases which supports this.

In the meantime, I'll fix the docs.

Closing this for now.