我让js
文件mongodb
在我得到console.log
调试表达式的地方运行:
use test;
db.city.find().snapshot().forEach(function(city){
var Pos = city.Pos;
if (Pos)
{
longLat = Pos.split(" ");
console.log("longLat"); // for debugging ----------------------------
console.log(longLat);
lon = longLat[0];
lat = longLat[1];
if (lon && lat)
{
lon = parseFloat(lon);
lat = parseFloat(lat);
longLat = [lon, lat];
city.longLat = longLat;
}
}
db.orgs.save(city);
})
当我运行它...
mongo < /path/to/this/js/file.js
...我在输出中遇到错误:
ReferenceError: console is not defined
有没有办法记录中间结果以进行调试?