具有地理空间条件的Mongo组 [英] Mongo group with geospatial condition

查看:34
本文介绍了具有地理空间条件的Mongo组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试汇总具有地理空间条件的结果时遇到问题:

I have an issue when I try to aggregate results with a geospatial condition :

db.users.group({
    reduce: function(obj, prev) {
      prev.sums = {
        y_levels: prev.sums.y_levels + obj.current_y_level,
        x_levels: prev.sums.x_levels + obj.current_x_level,
        count: prev.sums.count + 1
      }
    },
    cond: {current_position: { $near: [56.553823, 8.565619, 10]}}, 
    initial: { sums: { y_levels: 0, x_levels: 0, count: 0 } }
});

产生:

uncaught exception: group command failed: {
        "errmsg" : "exception: manual matcher config not allowed",
        "code" : 13285,
        "ok" : 0

我对正常"情况没有问题.

I have no issue with a "regular" condition.

有什么主意吗?

推荐答案

我相信您在这里看到此错误: http://jira.mongodb.org/browse/SERVER-1742

I believe that you are seeing this bug here: http://jira.mongodb.org/browse/SERVER-1742

所引用的错误使用Map-Reduce命令,但组"实际上只是Map-Reduce的一个准备好的子集.

The bug referenced uses the Map-Reduce command, but "group" is really just a prepared subset of Map-Reduce.

如果您需要此功能,请对其进行投票,以便对其进行适当的优先排序.

If you need this functionality, please vote it up so that it can be appropriately prioritized.

这篇关于具有地理空间条件的Mongo组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆