couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Chris Anderson <jch...@gmail.com>
Subject Re: Getting problen in design document
Date Fri, 26 Mar 2010 16:14:56 GMT

On Mar 26, 2010, at 3:41 AM, Ajay Pawaskar wrote:

> Hi all,
> 
>            I am running in this issue regarding Boolean values.
> 

It is hard to diagnose the problem given your description. Your JS function looks workable
(you could probably simplify it a bit, but I don't see anything obviously wrong with it.)

A note on terminology: I think you mean "map function" when you are saying _design document.
Perhaps you are not correctly storing and invoking your map function?

see the first figure here:

http://books.couchdb.org/relax/design-documents/design-documents

Chris

> I have a document
> 
> 
> 
> {
>   "_id": "1-BRE",
>   "_rev": "5-2793086578",
>   "type": "XXXX",
>   "Module": "YYYY",
>   "isUpdated": false,
>   "ResReq": true //// boolean value
> }
> 
> 
> 
> And a design document
> 
> 
> 
> function(doc) {    
> 
> if(doc.IncludeinRestorePoint == true){      //// here I m trying with
> Boolean value for  IncludeinRestorePoint
> 
>                        var isHtml=false;
> 
>                        if(doc.htmlDoc){
> 
>                                    isHtml=true
> 
>                        }else{
> 
>                                    isHtml=false;
> 
>                        }
> 
>                        if(!isHtml){
> 
>                                    emit(doc._id,
> {"Doc":doc,"IsHtml":isHtml})
> 
>                        }else{
> 
>                                    emit(doc._id,
> {"ID":doc._id,"IsHtml":isHtml})
> 
>                        }
> 
>            }
> 
> }
> 
> 
> 
> Above design document gives me proper results when I run it on futon
> (browser)
> 
> 
> 
> But when I called it from my application it don't even give a hit to
> design document ( I found it from erlang log)
> 
> 
> 
> But when I change my document & design document as follow it's working
> fine (I can hit it from my application)
> 
> 
> 
> 
> 
> {
>   "_id": "1-BRE",
>   "_rev": "5-2793086578",
>   "type": "XXXX",
>   "Module": "YYYY",
>   "isUpdated": false,
>   "ResReq": "true" //// changed to the string value
> }
> 
> 
> 
> And a design document
> 
> 
> 
> function(doc) {    
> 
> if(doc.IncludeinRestorePoint == "true"){ //// changed to the string
> value
> 
> 
> 
>                        var isHtml=false;
> 
>                        if(doc.htmlDoc){
> 
>                                    isHtml=true;
> 
>                        }else{
> 
>                                    isHtml=false;
> 
>                        }
> 
>                        if(!isHtml){
> 
>                                    emit(doc._id,
> {"Doc":doc,"IsHtml":isHtml})
> 
>                        }else{
> 
>                                    emit(doc._id,
> {"ID":doc._id,"IsHtml":isHtml})
> 
>                        }
> 
>            }
> 
> }
> 
> 
> 
> Guys will u please tell me what would be the issue?
> 
> 
> 
> Note: I have other design docs where I am evaluating against the Boolean
> value it's working fine
> 
> 
> 
> 
> 
> How Many Roads Must A Man Travel Down 
> 
> Before He Admits He is Lost?
> 
> 
> 
> Thanks & Regards
> 
> Ajay J. Pawaskar
> 
> 
> 


Mime
View raw message