Mongo group with geospatial condition

一世执手 提交于 2019-12-13 17:03:57

问题


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 } }
});

produces :

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

I have no issue with a "regular" condition.

Any idea?


回答1:


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

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.



来源:https://stackoverflow.com/questions/5433322/mongo-group-with-geospatial-condition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!