Le 23 mars 2010 à 22:51, A.J. Brown a écrit :
> Hi All,
>
> I'm having some trouble querying a view. Can you help me out? I'm
> trying to query a view of comments for a specific topic. My view has
> the topic document id and a ISO date string as the key.
>
> I've tried many combinations of the following, but no matter what I
> always get the entire list of comments back. There are 3 comments in
> the database that should match (have the correct topic_id) and 6 total
> rows.
>
> startKey=["2e7768c509e896e658ecb75f3c1cf84c",null]&endKey=["2e7768c509e896e658ecb75f3c1cf84c",{}]
> startKey=["2e7768c509e896e658ecb75f3c1cf84c"]&endKey=["2e7768c509e896e658ecb75f3c1cf84c",{}]
> startKey=["2e7768c509e896e658ecb75f3c1cf84c",null]&endKey=["2e7768c509e896e658ecb75f3c1cf84c","\u9999"]
> startKey=["2e7768c509e896e658ecb75f3c1cf84c",null]&endKey=["2e7768c509e896e658ecb75f3c1cf84c",null,
> null]
I think your problem is here : "startkey" and "endkey" (all in lower case)
>
> Here's the map function for that view:
>
> function(doc) {if( doc.type == 'comment' ) { emit( [doc.topic_id,
> doc.created], doc );}}
>
> And here's an example comment document:
>
> {
> "_id": "1b324c9430cd734bc08ae773c659170c",
> "_rev": "1-8526badbb1259f10cd4b938a2e7c3918",
> "type": "comment",
> "author": "ajbrown",
> "topic_id": "2e7768c509e896e658ecb75f3c1cf84c",
> "parent_comment_id": "",
> "message": "tsetst etettstts",
> "created": "2010-03-23T17:32:19-04:00"
> }
>
> In Futon, my keys look right. Example:
>
> ["2e7768c509e896e658ecb75f3c1cf84c", "2010-03-23T17:32:19-04:00"]
>
> --
> A.J. Brown
> Software Engineer, ZCE
> blog : http://ajbrown.org
> talk : (937) 540-0099
> chat : IntypicaAJ