无法识别的运算符:$ geoIntersects

时间:2017-01-04 09:05:32

标签: mongodb meteor

我正在运行此查询,我得到: “未捕获的错误:无法识别的运算符:$ geoIntersects”

RestPolygons.findOne({restRefId: 'Fsmbi94HahsRJH9rT', zoneCoordinates: {$geoIntersects:
                    {$geometry:{ "type" : "Point",
                        "coordinates" : [34.7791114, 32.077278299999996]}
                    }
                }})

如果我用$ geoWithin替换$ geoIntersects,我会得到“无法识别的运算符:$ geoWithin”

2 个答案:

答案 0 :(得分:1)

https://docs.mongodb.com/manual/reference/operator/query/geoIntersects /

RestPolygons.find(
       {
         loc: {
           $geoIntersects: {
              $geometry: {
                 type: "Polygon" ,
                 coordinates: [
                   [ [ 0, 0 ], [ 3, 6 ], [ 6, 1 ], [ 0, 0 ] ] // for use like 
                 ]
              }
           }
         }
       }
    )

答案 1 :(得分:0)

已在版本2.4 geoIntersects

中添加

你在运行哪个版本的mongo?