【发布时间】:2018-12-02 11:02:52
【问题描述】:
鉴于我的数据库中的以下文档:
{
"_id" : ObjectId("5c03b36d13032cc192d33f84"),
"type" : "Feature",
"properties" : {
"name" : "point 1",
"amenity" : "test",
"popupContent" : "test"
},
"geometry" : {
"type" : "Point",
"coordinates" : [
[ -3.68814468383789,
40.5248912033234]
]
}
}
并给出以下猫鼬查询:
function findVertex(req,res){
Vertex2.find({"_id":"5c03b36d13032cc192d33f84"}, function(err,obj) {
if(err){
res.status(500).send(error);
}else{
var geoJson=obj[0];
console.log(geoJson)
res.status(200).send(geoJson);
}
})
}
我收到的是:
{ properties: { name: 'point 1', amenity: 'test', popupContent: 'test' },
_id: 5c03b36d13032cc192d33f84,
type: 'Feature' }
为什么响应中没有几何?如果我在 robomongo 中执行相同的查询,我会得到带有坐标的对象。
【问题讨论】:
-
你的 mongoose 和 mongodb 版本是什么?
标签: node.js mongoose leaflet gis geojson