0
我正在研究nodejs後端的地理位置搜索。而mongodb是數據庫。爲了做到這一點,我從前端獲得價值。我正在使用地圖getbound來獲取視口數據。以下是一些包含經度和緯度的變量。如何創建座標數組?
var topLeftLong = parseFloat(req.body.topLeftLong);
var topLeftLat = parseFloat(req.body.topLeftLat);
var topRightLong = parseFloat(req.body.topRightLong);
var topRightLat = parseFloat(req.body.topRightLat);
var bottomRightLong = parseFloat(req.body.bottomRightLong);
var bottomRightLat = parseFloat(req.body.bottomRightLat);
var bottomLeftLong = parseFloat(req.body.bottomLeftLong);
var bottomLeftLat = parseFloat(req.body.bottomLeftLat);
雖然我得到這些數據,我想把經度和緯度放在一個數組中。但是每當我嘗試在數組中推送數據時,我都會得到下面的錯誤。