You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Robert Recchia <ro...@gmail.com> on 2009/11/15 22:43:15 UTC

bulk insert

I have been playing couchdb for about 2 weeks now.  I'm having trouble
dealing with how to perform a bulk insert.
Is it possible to perform a bulk insert with a json file.  So lets say
i have a json file with all my documents that i want to insert what is
the syntax to insert them in bulk.  I have a db named albums with all
my favorite album names and the groups they are sung by.  How does
everyone else deal with bulk inserts.

-- 
Robert Recchia

Re: bulk insert

Posted by Zachary Zolton <za...@gmail.com>.
Robert,

Try this:

$ DB="http://127.0.0.1:5984/mydb"
$ curl -v -d '{"docs":[{"key":"baz","name":"bazzel"},{"key":"bar","name":"barry"}]}'
-X POST $DB/_bulk_docs
$ curl -v -d @your_file.json -X POST $DB/_bulk_docs

>From the wiki:

http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API


Cheers,

Zach


On Sun, Nov 15, 2009 at 3:43 PM, Robert Recchia <ro...@gmail.com> wrote:
> I have been playing couchdb for about 2 weeks now.  I'm having trouble
> dealing with how to perform a bulk insert.
> Is it possible to perform a bulk insert with a json file.  So lets say
> i have a json file with all my documents that i want to insert what is
> the syntax to insert them in bulk.  I have a db named albums with all
> my favorite album names and the groups they are sung by.  How does
> everyone else deal with bulk inserts.
>
> --
> Robert Recchia
>

Re: bulk insert

Posted by Michael McDaniel <co...@autosys.us>.
On Sun, Nov 15, 2009 at 04:43:15PM -0500, Robert Recchia wrote:
> I have been playing couchdb for about 2 weeks now.  I'm having trouble
> dealing with how to perform a bulk insert.
> Is it possible to perform a bulk insert with a json file.  So lets say
> i have a json file with all my documents that i want to insert what is
> the syntax to insert them in bulk.  I have a db named albums with all
> my favorite album names and the groups they are sung by.  How does
> everyone else deal with bulk inserts.
> 
> -- 
> Robert Recchia

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
curl -vX POST --data @/tmp/short_post.txt  http://localhost:5984/test_db/_bulk_docs

where short_post.txt looks like

{ "docs" : [ 
{ "name" : "test_a" , "date" : "Sun Jan 4, 2008" , "place" : "Portland" } ,
{ "name" : "test_b" , "date" : "Sun Jan 4, 2008" , "place" : "Portland" } ,
{ "name" : "test_c" , "date" : "Sun Jan 4, 2008" , "place" : "Portland" }
] }





~Michael

RE: bulk insert

Posted by Nils Breunese <N....@vpro.nl>.
Have you looked at the documentation for the HTTP Bulk Document API on the wiki?

http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API

Nils.
________________________________________
Van: Robert Recchia [robrecc@gmail.com]
Verzonden: zondag 15 november 2009 22:43
Aan: user@couchdb.apache.org
Onderwerp: bulk insert

I have been playing couchdb for about 2 weeks now.  I'm having trouble
dealing with how to perform a bulk insert.
Is it possible to perform a bulk insert with a json file.  So lets say
i have a json file with all my documents that i want to insert what is
the syntax to insert them in bulk.  I have a db named albums with all
my favorite album names and the groups they are sung by.  How does
everyone else deal with bulk inserts.

--
Robert Recchia

De informatie vervat in deze  e-mail en meegezonden bijlagen is uitsluitend bedoeld voor gebruik door de geadresseerde en kan vertrouwelijke informatie bevatten. Openbaarmaking, vermenigvuldiging, verspreiding en/of verstrekking van deze informatie aan derden is voorbehouden aan geadresseerde. De VPRO staat niet in voor de juiste en volledige overbrenging van de inhoud van een verzonden e-mail, noch voor tijdige ontvangst daarvan.

Re: bulk insert

Posted by Paul Davis <pa...@gmail.com>.
On Sun, Nov 15, 2009 at 4:43 PM, Robert Recchia <ro...@gmail.com> wrote:
> I have been playing couchdb for about 2 weeks now.  I'm having trouble
> dealing with how to perform a bulk insert.
> Is it possible to perform a bulk insert with a json file.  So lets say
> i have a json file with all my documents that i want to insert what is
> the syntax to insert them in bulk.  I have a db named albums with all
> my favorite album names and the groups they are sung by.  How does
> everyone else deal with bulk inserts.
>
> --
> Robert Recchia
>

Robert,

This should give you a good description of the _bulk_docs api.

http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API

Paul Davis