You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Paul Joseph Davis (JIRA)" <ji...@apache.org> on 2009/10/15 00:58:31 UTC

[jira] Commented: (COUCHDB-528) Views and keyed access

    [ https://issues.apache.org/jira/browse/COUCHDB-528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765800#action_12765800 ] 

Paul Joseph Davis commented on COUCHDB-528:
-------------------------------------------

Meno,

The keys in the POST'ed body should refer to the key that was emitted by the view. If that request works with _all_docs and you're wanting to use that with a view, your emit statement should be emit(doc._id, null).

Paul

> Views and keyed access
> ----------------------
>
>                 Key: COUCHDB-528
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-528
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 0.9.1
>         Environment: linux
>            Reporter: Meno Abels
>
> If you try eg.
> curl -v -d '{"keys":["srp_WPG","srp_WLUX"]}' http://localhost:5984/booking_reverseidxes/_design/Booking::ReverseIdx-0aab4fe0eb7bdb4ac59f67c4e9453b52/_view/all
> you will except in the best case a answer of two rows. If the two key rows exists. If I use _all_docs it works like excepted. If I use a view the answer is a empty rows array. 
> I had a in depth look to the source in ./src/couchdb/couch_httpd_view.erl
> but I am just to new with erlang, to find the problem and fix it. 
> It is still possible that I make a usage error, than feel free to blame me.
> I expect the problem in
> output_map_view(Req, View, Group, Db, QueryArgs, Keys) ->
> ....
> FoldlFun = make_view_fold_fun(Req,
>                     QueryArgs#view_query_args{
>                         start_key = Key,
>                         end_key = Key
>                     }, CurrentEtag, Db, RowCount,
>                     #view_fold_helper_funs{
>                         reduce_count = fun couch_view:reduce_to_count/1
>                     })
> which is the only differend code part between keyed and none keyed access.
> My map method in the view looks like this which should be harmless and not depend to the problem.
> {
>    "all": {
>        "map": "function(doc) {
>                  if (doc['couchrest-type'] == 'Booking::ReverseIdx') { emit(null,null); } 
>         }"
>    }
> }
> thx in advance
> meno

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.