MongoDB 在地理空间查询上计数不准确

发布于 2024-11-01 05:53:57 字数 738 浏览 7 评论 0原文

我正在查询靠近某个位置($near$maxDistance)且在某个日期范围内($or)的文档包含 3 组与日期/日程相关的 $gt/$lt 条件)。

我发现,无论 limit() 如何,即使有 100 个或更多结果,$cursor->count() 也总是返回 100。

看起来 $cursor->skip()->limit() 工作正常,允许我跳过 100 多个结果(当超过 100 个时),但令我困扰的是 < code>count() 总是返回 100,并且似乎没有办法确定完整计数(除了分页直到没有更多结果)。

我找到了对 地图缩减无法与地理空间正常工作的引用,并且 mongodb 文档引用了默认 limit() 为 100。

上面的查询找到最接近 (50,50) 的点,并返回按距离排序的点(不需要额外的排序参数)。使用 limit() 指定要返回的最大点数(如果未指定,则应用默认限制 100):

这是一个已知问题吗?我正在使用 PHP 驱动程序。

I'm querying for documents that are close to a location ($near and $maxDistance) and fall within a date range (an $or with a 3 sets of $gt/$lt conditions relating to dates/schedules).

I find that $cursor->count() always returns 100 even if there are 100 or more results regardless of limit().

It seems like $cursor->skip()->limit() work fine, allowing me to skip more than 100 results (when there are more than 100), but it bothers me that count() always returns 100 and there seems to be no way to determine the full count (other than paging until there are no more results).

I find references to map reduce not working correctly with geospatial, and the mongodb docs reference a default limit() of 100.

The above query finds the closest points to (50,50) and returns them sorted by distance (there is no need for an additional sort parameter). Use limit() to specify a maximum number of points to return (a default limit of 100 applies if unspecified):

Is this a known issue? I'm using the PHP driver.

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

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

发布评论

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

评论(1

梦在深巷 2024-11-08 05:53:57

等待向 geo-spital 添加 $ 或 $ 和支持一年:


Estimate: Medium ( < 1 week)
Fix Version/s: planned but not scheduled

https://jira.mongodb .org/browse/SERVER-3984

__
也许他们会在 2014 年支持这个;)
__

http://pastebin.com/raw.php?i=FD3xe6Jt

http://www.zopyx.de/blog/goodbye-mongodb

http://blog.engineering.kiip.me/post/20988881092/a -year-with-mongodb

http://blog.schmichael.com/2011/11/05/failing-与-mongodb/

Waiting for add $or $and support to geo-spital for a year:


Estimate: Medium ( < 1 week)
Fix Version/s: planned but not scheduled

https://jira.mongodb.org/browse/SERVER-3984

__
maybe they support this due 2014 ;)
__

http://pastebin.com/raw.php?i=FD3xe6Jt

http://www.zopyx.de/blog/goodbye-mongodb

http://blog.engineering.kiip.me/post/20988881092/a-year-with-mongodb

http://blog.schmichael.com/2011/11/05/failing-with-mongodb/

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