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 CA94A9813 for ; Sun, 20 Nov 2011 17:38:45 +0000 (UTC) Received: (qmail 82317 invoked by uid 500); 20 Nov 2011 17:38:44 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 82285 invoked by uid 500); 20 Nov 2011 17:38:43 -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 82277 invoked by uid 99); 20 Nov 2011 17:38:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Nov 2011 17:38:43 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of luke.bredeson@gmail.com designates 209.85.210.46 as permitted sender) Received: from [209.85.210.46] (HELO mail-pz0-f46.google.com) (209.85.210.46) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Nov 2011 17:38:36 +0000 Received: by pzk2 with SMTP id 2so12013093pzk.5 for ; Sun, 20 Nov 2011 09:38:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=K7mCfHxFSIMCvEVfeSk7vw5BPOR3l68yP0hq9818gmU=; b=Lm6Bl/rfT/DQbxFGNcEMMKg0bSQsyMjIQ1mwRTLEi9Wno+P9mfC2EMr3pMfsOsUrPu qFd9cCo39pVOaewFTECyL7ILmLN+Rpk/KFoGFBKZApFGodRBRMIbmcMqzugu+EX/t6rD 1Nw8CFj0HjtN6Q5MIvRNzULbG+z0GFdr3dJM0= MIME-Version: 1.0 Received: by 10.68.31.167 with SMTP id b7mr28281318pbi.57.1321810694996; Sun, 20 Nov 2011 09:38:14 -0800 (PST) Received: by 10.143.17.21 with HTTP; Sun, 20 Nov 2011 09:38:14 -0800 (PST) Date: Sun, 20 Nov 2011 11:38:14 -0600 Message-ID: Subject: Erlang view question From: Luke Bredeson To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=bcaec520f049ef82a204b22e08ce X-Virus-Checked: Checked by ClamAV on apache.org --bcaec520f049ef82a204b22e08ce Content-Type: text/plain; charset=ISO-8859-1 Hi, I have an Erlang view that is outputting a list of integers instead of a string. I know Erlang treats strings as lists of integers, but I thought CouchDB would take care of this for me. I'm sure it's a basic error on my part, so if anyone has any ideas of what I'm doing wrong, I'd appreciate it! Here's the relevant map function: fun({Doc}) -> case couch_util:get_value(<<"type">>, Doc) of <<"Crash">> -> Accdate = couch_util:get_value(<<"accdate">>, Doc), Year = string:substr(erlang:bitstring_to_list(Accdate), 7, 4), Emit([couch_util:get_value(<<"city">>, Doc), Year], 1); _ -> ok end end. I get values like: ["3425", [50, 48, 48, 56]], when I'm really looking for values like this: ["3425", "2008"]. Thanks, Luke --bcaec520f049ef82a204b22e08ce--