返回

提问 添加收藏

mongodb 子集合查询

wad12302 发布于 2019年07月12日 (共有0个回帖)

{
	"dataList": [{
		"orderStatus": "05",
		"orderNo": "598833159911505920",
		"sendNum": 2,
		"orderInfos": [{
			"subOrdeNo": "598833159911505920_1",
			"orderNo": "598833159911505920",
			"channelArea": "AAA",
			"userId": "594129006094188544"
		},
		{
			"subOrdeNo": "598833159911505920_2",
			"orderNo": "598833159911505920",
			"channelArea": "BBB",
			"userId": "594129006094188544"
		},
		]
	}, {
		"orderStatus": "06",
		"subStatus": null,
		"orderNo": "598459037436084224",
		"sendNum": 2,
		"orderInfos": [{
			"subOrdeNo": "598459037436084224_1",
			"orderNo": "598459037436084224",
			"channelArea": "AAA",
			"entId": "594129005670563840",
			"userId": "594129006094188544"
		},
		{
			"subOrdeNo": "598459037436084224_2",
			"orderNo": "598459037436084224",
			"channelArea": "BBB",
			"entId": "594129005670563840",
			"userId": "594129006094188544"
		}
		]
	}]
}

 

我的订单结构存储是:主订单orderNo, 子订单orderInfos 包含:subOrdeNo 子订单号,

现在我要查询列表,我想再查询条件里面 根据子订单参数查询"channelArea": "BBB",,

这样查询出来的应该是以 子订单信息为准,同时附带主订单信息,怎么查询

 

MongoDB
文明上网,理性发言
客户端 Android iPhone WP7