couchDB查询

编程入门 行业动态 更新时间:2024-10-11 01:17:12
本文介绍了couchDB查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是一个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查询

本文发布于:2023-10-30 04:42:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1541801.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:couchDB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!