且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Couchbase中的复合视图

更新时间:2023-09-23 23:08:16

在沙发床中,当您通过startkey-endkey查询视图时,无法按2个或更多属性过滤结果.Couchbase只有一个索引,因此它将仅按第一个参数过滤结果.因此,您的查询将与以下查询相同:

In couchbase when you query view by startkey - endkey you're unable to filter results by 2 or more properties. Couchbase has only one index, so it will filter your results only by first param. So your query will be identical to query with:

startkey = ["a"]
endkey = ["Z"]

这是一个链接来完成Filipe Manana的答案,为什么不能用这些日期过滤它.

Here is a link to complete answer by Filipe Manana why it can't be filtered by those dates.

这是它的引文:

对于复合键(数组),元素从左到右进行比较,并且当一个元素与另一个键中的对应元素不同时,比较会立即结束(与比较字符串àla memcmp()或strcmp时发生的情况相同)()).

For composite keys (arrays), elements are compared from left to right and comparison finishes as soon as a element is different from the corresponding element in the other key (same as what happens when comparing strings à la memcmp() or strcmp()).

因此,如果要使用按日期过滤的视图,则日期数组应在复合键中排在首位.

So if you want to have a view that filters by date, date array should go first in composite key.