我正在寻找n1ql查询,它在json中的数组中重试整个json满足条件
{
“lmrNumber”:“0000063”,
“权重”: “20”,
“loadNumber”:“SHREF”,
“lineHaulLmr”:[
{
“lineHaulResponsibileSite”: “4059”,
“lineHaulArrivalDate”:“01/06/2017”,
“lineHaulDepartureDate”:“01/06/2017”,
“lineHaulDepartureTime”:“21:00”,
“lineHaulArrivalTime”:“22:30”,
“lineHaulStatus”: “待定”,
“driverDetails”:{
“驱动程序名”: “”,
“SLOC”: “3719”,
“ELOC”: “3701”,
“工作编号”:””
}
}
]
}
条件是查询应该检索已在数组中获得sloc为4059
的数据。
我试过这种方式,但它没有检索数据
SELECT * FROM school Where '4059' IN school.lineHaulLmr[*].driverDetails.sloc
答案 0 :(得分:1)
尝试
SELECT * FROM school Where driverDetails.sloc = '8585'
答案 1 :(得分:0)
非常感谢您的回复。我得到了查询,它看起来像这样 SELECT * FROM School其中' 4059'在学校.lineHaulLmr []。driverDetails []。sloc