我有以下模型:
class
include Mongoid::Document
field :polygons, type: Hash
index({"polygon" => "2dsphere"})
end
当我尝试插入以下文档时出现错误:
{
_id: ObjectId('53467c7f476f6c551c020000'),
polygons: {
type: "MultiPolygon",
coordinates: [ [ [ [ 13.00695419311523, 47.81822655820738 ], [ 13.03579330444336, 47.75825258545904 ], [ 13.09175491333008, 47.7658685011539 ], [ 13.07767868041992, 47.81707386519431 ] ], [ [ 13.00695419311523, 47.81822655820738 ], [ 13.03579330444336, 47.75825258545904 ], [ 13.09175491333008, 47.7658685011539 ], [ 13.07767868041992, 47.81707386519431 ] ] ], [ [ [ 13.07355880737305, 47.8260641920274 ], [ 13.05810928344727, 47.80323955290061 ], [ 13.10857772827148, 47.80116408820393 ], [ 13.1041145324707, 47.82514217887775 ], [ 13.08626174926758, 47.8290606216547 ] ], [ [ 13.07355880737305, 47.8260641920274 ], [ 13.05810928344727, 47.80323955290061 ], [ 13.10857772827148, 47.80116408820393 ], [ 13.1041145324707, 47.82514217887775 ], [ 13.08626174926758, 47.8290606216547 ] ] ] ]
}
}
错误信息只说:
The operation: #<Moped::Protocol::Command ...> failed with error 16755: "Can't extract geo keys from object, malformed geometry?
根据http://geojsonlint.com/以上geojson 是有效的。我究竟做错了什么?