我是一个ouchDB新手,没有运气从我的观点中得到过滤的响应.无论查询如何,我总能得到整个视图,这是没有道理的.
I am a couchDB noob and am having no luck getting a filtered response from my views. No matter the query I always get the whole view, and this makes no sense.
例如在用户数据库中...我尝试了此地图功能,只是为了了解它的工作原理.
For example in a users database... I tried this map function, just to get a feel for how it works.
login: { map: function(doc){ if (doc.firstName && doc.lastName) emit(doc.firstName, doc.lastName); } }教科书的东西对吗?
但是当我发布一个看起来像这样的查询时...
But when I POST a query that looks like this...
{key: ["Mo"]} ... or ... {key:"Mo"}我得到了所有...整个视图!甚至这个...
I get back everything... the whole view! Even this...
{startkey:["Mo"], endkey:["Mo"]} ... or ... {startkey:"Mo", endkey:"Mo"}将查询编码到url中并执行GET可以得到相同的响应!
Encoding the query into the url and doing a GET gives me the same response!!
我该怎么做才能使它起作用?有什么特别的酱料?我需要牺牲动物吗?还是我只是不够放松?
What do I do to make this work? What's the special sauce? Do I need to sacrifice an animal? Or am I just not relaxing hard enough?
推荐答案因此,为了清楚起见,您的网址应如下所示:
So, just to be clear, your URL should look like this:
your.server/your_db/_design/view_id/_view/view_name?key="Mo"大多数浏览器会将这些"正确编码为%22 s
And most browsers will encode those "s correctly into %22s
更多推荐
couchDB查询
发布评论