You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Michael Hendricks <mi...@ndrix.org> on 2008/07/08 00:06:38 UTC

inserting a single document

Is there any reason to insert single documents into CouchDB by PUTing or
POSTing the document to the DB URL instead of using the _bulk_docs
interface?  If I've understood the source correctly, it looks as thoough
single inserts are handled internally by CouchDB in exactly the same way
as doing a bulk insert with a single document.

While updating some Perl bindings for CouchDB, I noticed that specially
handling single inserts requires unnecessary, duplicated code.  If
there's no compelling reason, I'll just reimplement single inserts in
terms of bulk insert.

Thanks.

-- 
Michael

Re: inserting a single document

Posted by Michael Hendricks <mi...@ndrix.org>.
On Tue, Jul 08, 2008 at 12:34:07AM +0200, Jan Lehnardt wrote:
> We strive for buzzword compliance and the buzzword in question
> is REST :-)
>
> Consider a client that is not interested in bulk insertion that only does
> and wants GET/PUT/POST/DELETE to a single resource. That's where
> the singe document PUT/POST API makes sense.

Thanks Jan.  I definitely like the PUT/POST API.  I use it quite a bit
with the couchdb commandline client … curl ;-)  It's sure handy.

> From your library's point of view, only using the bulk API is totally
> acceptable, though.

Great, I'll go ahead and do it that way then.  Thanks.

-- 
Michael

Re: inserting a single document

Posted by Jan Lehnardt <ja...@apache.org>.
On Jul 8, 2008, at 00:06, Michael Hendricks wrote:

> Is there any reason to insert single documents into CouchDB by  
> PUTing or
> POSTing the document to the DB URL instead of using the _bulk_docs
> interface?  If I've understood the source correctly, it looks as  
> thoough
> single inserts are handled internally by CouchDB in exactly the same  
> way
> as doing a bulk insert with a single document.
>
> While updating some Perl bindings for CouchDB, I noticed that  
> specially
> handling single inserts requires unnecessary, duplicated code.  If
> there's no compelling reason, I'll just reimplement single inserts in
> terms of bulk insert.


We strive for buzzword compliance and the buzzword in question
is REST :-)

Consider a client that is not interested in bulk insertion that only  
does
and wants GET/PUT/POST/DELETE to a single resource. That's where
the singe document PUT/POST API makes sense.

 From your library's point of view, only using the bulk API is totally
acceptable, though.

Cheers
Jan