开发者

Cosmos DB filter external array using collection

开发者 https://www.devze.com 2022-12-07 22:39 出处:网络
I want to find which items in my array are NOT in the collection.I can filter a collection based on an array, no problem.But, can I filter an array based on the collection in a single query?

I want to find which items in my array are NOT in the collection. I can filter a collection based on an array, no problem. But, can I filter an array based on the collection in a single query?

This document talks about constructing a join to 'external reference data' so you can include this data in your query:

https://learn.microsoft.com/en-gb/azure/cosmos-db/nosql/query/subquery#mimic-join-with-external-reference-data

I can't figure out if its possible to select from an array, like the units table referenced in the link, and then filter this to NOT include items from the collection? This type of query doesn't work:

SELECT * from (select value ["valueA", "valueB"]) as x 
JOIN y in collectionName 
WHERE x not arra开发者_运维知识库y_contains(x, y.property)

It seems I HAVE to select from the collection first as in: select [whatever] from COLLECTION. I can't select from an array THEN join the collection like: select [whatever] from ARRAY() join COLLECTION?

Do I have to pull the ENTIRE collection (restructured docs, just the data I want) then filter the array in code?

0

精彩评论

暂无评论...
验证码 换一张
取 消