db.getCollection('order').find({bundleProducts:{$elemMatch:{id:"5720a0ce7709"}}}).forEach(
function(order){ print(
"invoice addresses: " + order.addresses.invoice.city + "," +
" delivery addresses: "+ order.addresses.delivery.city+","+
" setup addresses: "+ order.addresses.setup.city+","); }) ;当我运行上述问题时
无法执行脚本。
Error:
TypeError: order.addresses.setup is undefined :
@(shell):5:1
DBQuery.prototype.forEach@src/mongo/shell/query.js:501:1
@(shell):1:1我收到一个错误。如果安装地址为空,如何编写查询?
https://stackoverflow.com/questions/47510043
复制相似问题