CouchDB 排序 - 排序规范

发布于 2024-12-02 03:23:07 字数 292 浏览 0 评论 0原文

排序规则规范

使用 CouchDB 视图,我的键似乎没有按照排序规则排序。

rows:
   [0] key: ["bylatest", -1294536544000] value: 1         
   [1] key: ["bylatest", -1298817134000] value: 1
   [2] key: ["bylatest", -1294505612000] value: 1

我预计第二个条目会在第三个条目之后出现。

为什么会发生这种情况?

Collation Specification

Using a CouchDB view it seems my keys aren't sorted as per the collation specification.

rows:
   [0] key: ["bylatest", -1294536544000] value: 1         
   [1] key: ["bylatest", -1298817134000] value: 1
   [2] key: ["bylatest", -1294505612000] value: 1

I would of expect the second entry to come after the third.

Why is this happening?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

離人涙 2024-12-09 03:23:07

我得到了发出您指示的值的视图的结果。

{"total_rows":3,"offset":0,"rows":[
{"id":"29e86c6bf38b9068c56ab1cd0100101f","key":["bylatest",-1298817134000],"value":1},
{"id":"29e86c6bf38b9068c56ab1cd0100101f","key":["bylatest",-1294536544000],"value":1},
{"id":"29e86c6bf38b9068c56ab1cd0100101f","key":["bylatest",-1294505612000],"value":1}
]}

这些行与您的示例中的两个都不同。它们通过以最小(最大负数)值开始并以最大值(在本例中为最小负数)结束来符合排序规范。

您是否可以包含您正在使用的文档和映射/归约功能?

I get this result for a view emitting the values you indicate.

{"total_rows":3,"offset":0,"rows":[
{"id":"29e86c6bf38b9068c56ab1cd0100101f","key":["bylatest",-1298817134000],"value":1},
{"id":"29e86c6bf38b9068c56ab1cd0100101f","key":["bylatest",-1294536544000],"value":1},
{"id":"29e86c6bf38b9068c56ab1cd0100101f","key":["bylatest",-1294505612000],"value":1}
]}

The rows are different from both of your examples. They fit the collation specification by beginning with the smallest (greatest magnitude negative) value and ending with the greatest value (least magnitude negative in this case).

Would you perhaps include the documents and map/reduce functions you are using?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文