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 404AA716D for ; Fri, 9 Dec 2011 09:01:46 +0000 (UTC) Received: (qmail 55195 invoked by uid 500); 9 Dec 2011 09:01:42 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 53479 invoked by uid 500); 9 Dec 2011 09:01:39 -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 52236 invoked by uid 99); 9 Dec 2011 09:01:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Dec 2011 09:01:37 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rasmussen.bryan@gmail.com designates 209.85.210.180 as permitted sender) Received: from [209.85.210.180] (HELO mail-iy0-f180.google.com) (209.85.210.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Dec 2011 09:01:29 +0000 Received: by iaae16 with SMTP id e16so5667769iaa.11 for ; Fri, 09 Dec 2011 01:01:08 -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=5yOSdLFSuPASxdxB2xNlTeqjOTrjgpMv0poXK3eSHHk=; b=XKb0n2Xa5i5IHge0bkjxiSKGN/shChd0gp1SD/Zn6sM/+ztteVHuWaIEAcAU9Fndd4 1xrSEfvu11wDlbFa8G6nQUZ8y4aRLK03Qg+i5rpDaygPVqoI4feyCbEO66geHu0iou6X qIFUsGOwWQ51cUvyktEwzyeyWMHst7KfagN2E= MIME-Version: 1.0 Received: by 10.42.29.137 with SMTP id r9mr2195572icc.20.1323421268452; Fri, 09 Dec 2011 01:01:08 -0800 (PST) Received: by 10.231.143.149 with HTTP; Fri, 9 Dec 2011 01:01:08 -0800 (PST) Date: Fri, 9 Dec 2011 10:01:08 +0100 Message-ID: Subject: advice on how to get equal number of items of different types from db From: bryan rasmussen To: user@couchdb.apache.org Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org Hi, I have a db where items in the db are of different types, lets say type A, B, and C. There are a lot of items in the db, and I am returning 60 at a time in my view. I could theoretically end up in a situation where my first 1000+ results are of type A when what I want is an even mix of type A,B and C. I could of course do a view for each type but this is problematic in that my view is called at the application's load via Ajax, and I don't want to send off 3 requests at that time. So what I want is a view or mapreduce or other Couchdb functionality that allows me to return a mix of my types? Any pointers, suggestions? Thanks, Bryan Rasmussen