Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A46E378C8 for ; Tue, 18 Oct 2011 11:58:02 +0000 (UTC) Received: (qmail 19882 invoked by uid 500); 18 Oct 2011 11:58:01 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 19850 invoked by uid 500); 18 Oct 2011 11:58:01 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 19842 invoked by uid 99); 18 Oct 2011 11:58:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Oct 2011 11:58:01 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [80.244.253.218] (HELO mail.traeumt.net) (80.244.253.218) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Oct 2011 11:57:54 +0000 Received: from rose.local (p5795A8D2.dip.t-dialin.net [87.149.168.210]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.traeumt.net (Postfix) with ESMTPSA id BC1E53C18B for ; Tue, 18 Oct 2011 13:57:33 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1251.1) Subject: Re: Error when uploading json data file From: Jan Lehnardt In-Reply-To: Date: Tue, 18 Oct 2011 13:57:34 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <44F3A1D1-B0CD-4223-9C43-745899677B02@apache.org> References: To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1251.1) On Oct 18, 2011, at 04:52 , Pulkit Singhal wrote: > Something I forgot to mention, I'm running CouchDB version 1.1.0 >=20 > 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. >=20 > 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=3D`cat productSample.json` curl -d "{\"docs\":[$DOC]}" -X POST = http://localhost:5984/bbyopen/_bulk_docs -H "Content-Type: = application/json" may work. Cheers Jan --=20 >=20 > The imaginary syntax I give above is obviously bull crap. >=20 > - Pulkit >=20 > On Mon, Oct 17, 2011 at 9:41 PM, Max Ogden wrote: >> Your data has to be formatted like this: >>=20 >> {"docs": [{"hello": "world"}, {"hello": "world"}, {"hello": = "world"}]} >>=20 >> Also if you set log_level to debug in your couch settings then you = may get a >> more helpful error message >>=20 >> On Mon, Oct 17, 2011 at 7:38 PM, Pulkit Singhal = wrote: >>=20 >>> I see the following log on the server side: >>>=20 >>> [info] [<0.17288.0>] Stacktrace: [{lists,map, >>> = [#Fun, >>> 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}] >>>=20 >>> 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" >>>=20 >>> Can anyone help me figure out what the problem is? >>>=20 >>> Thanks! >>> - Pulkit >>>=20 >>=20