【发布时间】:2018-07-26 15:02:48
【问题描述】:
我的根数据有几个子集合,我需要对其中的两个做一个 where 子句,示例:
{
"id": "000092224369_0030",
....
"orderData": {
...
"request_secondary": {
"_type": "request_secondary",
"secondary_requests": [{
"secondary_description":"do something" }]
},
"partnership": {
"contacts": [
{
"role": "AG",
"first_name": "LIEBENS Eric",
"last_name": null,
"_type": "contact",
"email": "eric.liebens@gmail.com",
"tel1": "0495-543905",
"tel2": null,
"vat": null
},
{
"role": "ZO",
"first_name": "Coralie",
"last_name": "Demeyere",
"_type": "contact",
"email": "coralie.demeyere@ores.net",
"tel1": "069/256533",
"tel2": null,
"vat": null
},
{
"role": "ZR",
"first_name": "GASBARRO Gianni",
"last_name": null,
"_type": "contact",
"email": null,
"tel1": "0495-385479-0",
"tel2": null,
"vat": "BE0474281005"
}
],
...
在这里,我需要执行一个查询,以带回任何 secondary_description 等于文本的记录,或带有该文本的姓名的联系人。 它应该翻译成 sql 的东西:
SELECT c.id from c
join x in c.orderData.request_secondary
join y in c.orderData.partnership.contacts
where x.secondary_description ='sometin' or y.first_name= 'sometin'
我已经尝试过这个解决方案: How to query sub document (list type) in Cosmos Db
它适用于一个子集合,但我不知道如何让它与几个 selectmany 一起工作...... 有什么办法可以在 linq 中做到这一点? 谢谢!
【问题讨论】:
标签: c# linq azure-cosmosdb