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 3181F96CD for ; Sat, 24 Dec 2011 11:11:27 +0000 (UTC) Received: (qmail 46564 invoked by uid 500); 24 Dec 2011 11:11:22 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 46516 invoked by uid 500); 24 Dec 2011 11:11:22 -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 46487 invoked by uid 99); 24 Dec 2011 11:11:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Dec 2011 11:11:22 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of shreekumar@worlditlab.com designates 174.36.186.226 as permitted sender) Received: from [174.36.186.226] (HELO svr11.premiumwebserver.com) (174.36.186.226) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Dec 2011 11:11:17 +0000 Received: from ABTS-KK-static-021.227.166.122.airtelbroadband.in [122.166.227.21] by svr11.premiumwebserver.com with SMTP; Sat, 24 Dec 2011 03:10:48 -0800 Message-ID: <204C9336EEAE4992BCD4526DAB59E35D@ShreeLappy> Reply-To: "Shreekumar" From: "Shreekumar" To: References: In-Reply-To: Subject: Re: Unable to access all the documnets by 'documentType' property Date: Sat, 24 Dec 2011 16:40:39 +0530 Organization: Worlditlab MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 15.4.3538.513 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3538.513 The Couch DB access log looks like this [Sat, 24 Dec 2011 11:02:34 GMT] [info] [<0.23369.58>] - - 'GET' /ashoka/_design/Android/_view/by_documentType?reduce=false&include_docs=true&limit=1 200 [Sat, 24 Dec 2011 11:09:09 GMT] [info] [<0.24351.58>] - - 'GET' /ashoka/_local/dab7fbc0cd3651ad631f4bf58fffc74f 200 [Sat, 24 Dec 2011 11:09:10 GMT] [info] [<0.24352.58>] - - 'HEAD' /ashoka/ 200 [Sat, 24 Dec 2011 11:09:11 GMT] [info] [<0.24354.58>] - - 'GET' /ashoka/ 200 [Sat, 24 Dec 2011 11:09:12 GMT] [info] [<0.24356.58>] - - 'GET' /ashoka/_local/2bf6dff4a2977f01b6fff21a6c868aad 200 [Sat, 24 Dec 2011 11:09:12 GMT] [info] [<0.24357.58>] - - 'HEAD' /ashoka/ 200 [Sat, 24 Dec 2011 11:09:13 GMT] [info] [<0.24359.58>] - - 'GET' /ashoka/ 200 [Sat, 24 Dec 2011 11:09:14 GMT] [info] [<0.24361.58>] - - 'GET' /ashoka/_local/e5ac861d5e4466b8b2407417b6ff8f7e 200 -----Original Message----- From: Daniel Bryan Sent: Saturday, December 24, 2011 12:52 PM To: user@couchdb.apache.org ; Shreekumar Subject: Re: Unable to access all the documnets by 'documentType' property With something like this I'd usually start by looking at the CouchDB access log to see what query Couch is receiving - that way you know whether the problem is in Couch (say, in the view that's been stored) or in your Ruby library. I suspect there's some nuance in the query language of the latter that you're missing. On Dec 24, 2011 4:52 PM, "Shreekumar" wrote: > Good day! > > I�ve around 1500 documents which has documentType as a field. And each > document belongs to any one of the types (i.e. �Survey�,�Response� and > �Questions�). I�m using CouchRest model to access the CouchDB documents > with Ruby On Rails platform. > > My documents looks like as follows. > { > "_id": "ff2fb2554682ba613c2f83c63502808a", > "_rev": "4-dd559696434a402739e789ccc8c9a481", > "answers": [ > { > "answers": [ > "Aug 19,2011" > ], > "questionId": "50f3df434ae02ac7fff48c1c2bde83e4" > }, > { > "answers": [ > "Bechu Yadav" > ], > "questionId": "15504f006e58872fd94871fe0c9d32ad" > }, > { > "answers": [ > "35" > ], > "questionId": "3c447a2f5cc6ca1985ce2c81463a3c47" > }, > { > "answers": [ > "Male" > ], > "questionId": "a6df7c25602939554612ef6de762f5b9" > }, > { > "questionId": "2f66155965e60094f23f01af531d5af1", > "subAnswers": [ > { > "questionId": "1dae2d86eef846c967254c9e369170ce" > }, > { > "questionId": "40ffeb4d33dab1fe8d2d8b73c02ed13b" > }, > { > "questionId": "2db1e8b6e97d5baa8935b9b31fcc9648" > }, > { > "questionId": "0f8bb9f91ea8085b4ffb839ee8deabb5" > }, > { > "questionId": "22a93ecb72c50ff8899f8b2937776e51" > }, > { > "questionId": "e5106384790c2be745c952c4b867a0ff" > } > ] > > "questionId": "492cf9bd41257ea478c5222fbba06616" > } > ], > "createdAt": "2011-08-19T21:05:36.486+0000", > "createdBy": "user4", > "documentType": "Response", > "ipAddress": "42.110.85.67", > "location": { > "latitude": 26.8415613, > "longitude": 75.8222883, > "provider": "network" > }, > "surveyId": "6df022f0f371752167ad4920b38e1c37", > "published": true > } > > and my CouchRest (Android) class looks like this. > > require 'couchrest_model' > class Android < CouchRest::Model::Base > property :description, String > property :_id, String > property :_rev, String > property :documentType, String > design do > view :by_documentType > end > end > > and my view looks like this > > function(doc) > { > if(doc.documentType=='Survey') > emit(doc._id, null); > } > this is very basic code and working fine, and it�s returning 19 rows. (all > the documents which have documentType=�Survey�). but when I�m trying to > access this code in RoR by using CouchRest model; It�s returning only last > Document (19th Document). > > My ruby (irb)command line looks like this > > Android.find_by_documentType('Survey')Please help me to solve this. > > > > -- Warm Regards > Shreekumar > Sr. Software Engineer > World IT Lab | A division of Animika Studios Pvt. Ltd. > 41, 1st Cross off Kalidasa Road, Jayalaxmipuram > Mysore - 570 012 > [M] +91 94498 36388 | [T] +91 821 2411 577 > [Web] www.worlditlab.com | www.animikastudios.com > [Email] mailto:shreekumar@worlditlab.com > > "This e-mail and any attachments to it (the "Communication") is, unless > otherwise stated, confidential, may contain copyright material and is for > the use only of the intended recipient. If you receive the Communication > in > error, please notify the sender immediately by return e-mail, delete the > Communication and the return e-mail, and do not read, copy, retransmit or > otherwise deal with it. Any views expressed in the Communication are those > of the individual sender only, unless expressly stated to be those of > Animika Studios Pvt. Ltd. Animika Studios does not accept liability in > connection with the integrity of or errors in the Communication, computer > virus, data corruption, interference or delay arising from or in respect > of > the Communication." > > >