Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 94521 invoked from network); 2 Jun 2009 14:23:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Jun 2009 14:23:46 -0000 Received: (qmail 76871 invoked by uid 500); 2 Jun 2009 14:23:57 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 76817 invoked by uid 500); 2 Jun 2009 14:23:57 -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 76807 invoked by uid 99); 2 Jun 2009 14:23:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jun 2009 14:23:57 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of fils@iastate.edu designates 129.186.140.15 as permitted sender) Received: from [129.186.140.15] (HELO mailhub-5.iastate.edu) (129.186.140.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jun 2009 14:23:47 +0000 Received: from devirus-11.iastate.edu (devirus-11.iastate.edu [129.186.1.48]) by mailhub-5.iastate.edu (8.12.11.20060614/8.12.10) with SMTP id n52ENQLZ018500 for ; Tue, 2 Jun 2009 09:23:26 -0500 Received: from (despam-10.iastate.edu [129.186.140.80]) by devirus-11.iastate.edu with smtp id 0838_eff9368a_4f80_11de_9c9a_001372578af6; Tue, 02 Jun 2009 09:23:26 -0500 Received: from [129.186.121.156] (cws3.geol.iastate.edu [129.186.121.156]) by despam-10.iastate.edu (8.14.2/8.12.10) with ESMTP id n52ENPB5017161 for ; Tue, 2 Jun 2009 09:23:26 -0500 Message-ID: <4A2535DD.5030505@iastate.edu> Date: Tue, 02 Jun 2009 09:23:25 -0500 From: Douglas Fils User-Agent: Thunderbird 2.0.0.21 (X11/20090302) MIME-Version: 1.0 To: user@couchdb.apache.org Subject: post design documents Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 5.5.3.366731, Antispam-Engine: 2.7.0.366912, Antispam-Data: 2009.6.2.141346 X-ISUMailhub-test: Gauge=IIIIIII, Probability=8%, Report='BODY_SIZE_1700_1799 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, FROM_EDU_TLD 0, TO_NO_NAME 0, WEIRD_PORT 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_419_REFNUM 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __USER_AGENT 0' X-Virus-Checked: Checked by ClamAV on apache.org All, So I was looking at the "View Snippets" page (ref: http://wiki.apache.org/couchdb/View_Snippets) and noted the curl command. I am using something similar but rather than on the command line I place the map reduce code in a file. So if I take the code Brian, sent me this morning and put it in a file in a manner like I have appended to the end of this email I can use something like: curl -s -i -X POST -H 'Content-Type: application/json' --data @getFieldNamesv2.js 'http://xxx.xxx.xxx.xxx:5984/jcoresgarden/_temp_view?group=true' rather than needing to place the .js in the command line argument directly. The question is... I've tried some combinations, but can't seem to get an approach that would allow me to post the map reduce code to a _design document rather than just a _temp_view as in this example. Is it possible, once you have a map reduce code you like and tested against a small test data set to then POST it via curl for example, against the production database or do you have to place the design documents in via the gui? Thanks Doug Thanks again to Brian, Chris and Blair for your help on that "find unique fields..." thread -------- start file-------- { "map": "function(doc) { for (var key in doc) { emit(key,null) } }", "reduce": "function(ks, vs, co) { if (co) { var result = vs.shift(); for (var i in vs) { for (var j in vs[i]) { result[j] = (result[j] || 0) + vs[i][j]; } } return result; } else { var result = {}; for (var i in ks) { var key = ks[i]; result[key[0]] = (result[key[0]] || 0) + 1; } return result; } }" } --------- end file --------