Thanks Jan, that's a great idea! But sadly it fails for me because of file size like so: -bash: /opt/local/bin/curl: Argument list too long
Any other suggestions? :) On Tue, Oct 18, 2011 at 6:57 AM, Jan Lehnardt <[email protected]> wrote: > > On Oct 18, 2011, at 04:52 , Pulkit Singhal wrote: > >> Something I forgot to mention, I'm running CouchDB version 1.1.0 >> >> But that is pointless now because Max Ogden was right about needing to >> edit/format my json file like so: >> {"docs": [my original file data]} >> But something about having to edit the json file bugs me a little. So >> I wanted to further draw upon your expertise. >> >> Is it possible to somehow type a command from the command like in the >> following manner to get it to work? >> curl -d {"docs": [@productSample.json]} -X POST >> localhost:5984/bbyopen/_bulk_docs >> -H "Content-Type: application/json" > > curl -d "{\"docs\":[`cat productSample.json`]}" -X POST > http://localhost:5984/bbyopen/_bulk_docs -H "Content-Type: application/json" > > or > > DOC=`cat productSample.json` > curl -d "{\"docs\":[$DOC]}" -X POST http://localhost:5984/bbyopen/_bulk_docs > -H "Content-Type: application/json" > > may work. > > Cheers > Jan > -- > > > >> >> The imaginary syntax I give above is obviously bull crap. >> >> - Pulkit >> >> On Mon, Oct 17, 2011 at 9:41 PM, Max Ogden <[email protected]> wrote: >>> Your data has to be formatted like this: >>> >>> {"docs": [{"hello": "world"}, {"hello": "world"}, {"hello": "world"}]} >>> >>> Also if you set log_level to debug in your couch settings then you may get a >>> more helpful error message >>> >>> On Mon, Oct 17, 2011 at 7:38 PM, Pulkit Singhal >>> <[email protected]>wrote: >>> >>>> I see the following log on the server side: >>>> >>>> [info] [<0.17288.0>] Stacktrace: [{lists,map, >>>> [#Fun<couch_httpd_db.7.109081894>, >>>> undefined]}, >>>> {couch_httpd_db,db_req,2}, >>>> {couch_httpd_db,do_db_req,2}, >>>> {couch_httpd,handle_request_int,5}, >>>> {mochiweb_http,headers,5}, >>>> {proc_lib,init_p_do_apply,3}] >>>> >>>> When I run the following simple command to upload data from a file: >>>> curl -d @productSample.json -X POST localhost:5984/bbyopen/_bulk_docs >>>> -H "Content-Type: application/json" >>>> >>>> Can anyone help me figure out what the problem is? >>>> >>>> Thanks! >>>> - Pulkit >>>> >>> > >
