I have two documents which looks like this.
{
"CustomFields": [
{
"CustomFieldId": "FirstName",
"StringValue": "John",
},
{
"CustomFieldId": "LastName",
"StringValue": "Johnson",
}
],
"id": "f600bd8b-bca8-41a5-9f1c-0038e9cc7b35",
},
{
"CustomFields": [
{
"CustomFieldId": "FirstName",
"StringValue": "John",
},
{
"CustomFieldId": "LastName",
"StringValue": "Williams",
}
],
"id": "f600bd8b-bca8-41a5-9f1c-0038e9cc7b35",
}
I have tried this:
items = items.Where(x => x.CustomFields.All(
cf =>
cf.CustomFieldId == "01d1beab-8651-41df-ad93-ecc6195e912f" && cf.StringValue == "Pending"));
I'd like to build a query (either in SQL or LINQ - as long as its executable by documentdb) that will retrieve all the documents
where (CustomFieldId == "FirstName" and StringValue == "John")
AND (CustomFieldId == "LastName" and StringValue == "Williams")
Please do not suggest using ARRAY_CONTAINS as I need to leverage the indexes as the collection contains over 500,000 docs.
Thanks