benoitc / couchbeam

Apache CouchDB client in Erlang
Other
242 stars 113 forks source link

Complex keys #71

Closed kuloshius closed 12 years ago

kuloshius commented 12 years ago

What Options should I use in couchbeam_view:fetch/3 to be able to query view with complex keys? The URL I want to end up with is something like http://localhost:5984/devices/_design/devices/_view/by_grid_parent_and_status?key=[%228ac0a1772ded8a17e1467f89128b76fc%22,%20%22running%22]

Thanks

kuloshius commented 12 years ago

Ok, I have figured it out. couchbeam_view:fetch/3 view_options() start_key and end_key are not limited to binary, it also accepts list of binaries. So the function call couchbeam_view:fetch(Db::db(), {DesignName::string(), ViewName::string()}, [{key, [<<"8ac0a1772ded8a17e1467f89128b76fc">>, <<"running">>]}]) will work.