PyMongo:条件下具有二维地理空间索引的组返回错误
返回的错误是:
例外:不允许手动匹配器配置
这是我的代码:
cond = {'id': id, 'date': {'$gte': start_date}, 'date': {'$lte': end_date}, 'location': {'$within': {'$box': box }}}
reduce = 'function(obj, prev) { prev.count++; }'
rows = collection.group({'location': True}, cond, {'count': 0}, reduce)
当我从条件中删除位置时,它工作正常。如果我将查询更改为 find
它也可以正常工作,所以这是组的问题。
我做错了什么?
The error returned is:
exception: manual matcher config not allowed
Here's my code:
cond = {'id': id, 'date': {'$gte': start_date}, 'date': {'$lte': end_date}, 'location': {'$within': {'$box': box }}}
reduce = 'function(obj, prev) { prev.count++; }'
rows = collection.group({'location': True}, cond, {'count': 0}, reduce)
When I remove location from condition then it works fine. If I change the query to find
it works fine too so it's a problem with group.
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MongoDB 目前(版本 1.6.2)不支持 mapreduce 和 group 函数的地理查询。有关问题,请参阅 http://jira.mongodb.org/browse/SERVER-1742票(并考虑投票赞成)。
MongoDB currently (version 1.6.2) doesn't support geo queries for mapreduce and group functions. See http://jira.mongodb.org/browse/SERVER-1742 for the issue ticket (and consider voting it up).