0
一个JSON文件,如果我查询的MongoDB用一个简单的查询像这样用猫鼬:不能看到现场加与和的NodeJS猫鼬
User
.find()
.where('address.loc').near({ center: [lat,lng], maxDistance: 1 })
.exec(function(err, result) {
if (err) {
request.log(['server', 'database', 'error'], 'An error occured during the execution of the query');
}else{
for(var i=0;i<result.length;++i){
result[i]["distance"] = 5;
}
console.log(result[0].distance);
console.log(result[0])
}
});
第一的console.log打印:5
但第二个打印:
{ address: { loc: [ 37.0814402, 15.287517 ], value: 'viale tica' }, tags: [ 'Primi', 'Secondi' ], __v: 0, cap: 96100, ad_number: 15, business_email: '[email protected]', _id: 571b3b78249a2e160b4eee3f }
为什么这个文件,结果阵列中的其他人都没有场距离?
感谢。我没有考虑猫鼬的物体。 –