db.getCollection('d_snc_product_tc').find({"original_data.exceptDate" : { ne: []}}) 查詢tongcheng_product中original_data下exceptDate 不為空
db.getCollection('d_snc_product_tc').find({"sup_product_id": {"$exists": true}}) 查詢tongcheng_product 中存在sup_product_id的
lookup:連表查詢
db.getCollection('d_snc_product_tc').aggregate([
{$lookup: {
from: "d_snc_product_price_calendar_tc",
localField: "sup_product_id",
foreignField: "sup_product_id",
as: "member"
}
},
])
from: "要連接的表",
localField: "當(dāng)前Collection中需要連接的字段",
foreignField: "外連Collection中連接查詢的字段",
as: "把獲取到的的值賦值給這個(gè)字段