question

prasadk-6267 avatar image
0 Votes"
prasadk-6267 asked barretodz edited

Inner or left or right join between cosmos db collections

Hi Team,

I am trying to join two different collections in cosmos DB. Is it possible to join two collections or containers.
If not Please advise is it possible with Table API or any other.


Thanks.

azure-cosmos-db
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MarkBrownMSFT avatar image
0 Votes"
MarkBrownMSFT answered prasadk-6267 commented

No this is not supported. I would recommend you read the following articles on Cosmos DB so you understand the difference between a NoSQL and relational database and how best to model and partition data with in it. There are more docs you'll need to read of course too but these will help lay the groundwork as Cosmos is not a relational database and there is a learning curve associated with it.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Mark,

Thanks for providing useful information.

Looking for No sql DB which will support Joins like (SQL).Can you please suggest us.

Planning Below Flow for application.

Cosmos db container/collection which will store Raw JSon files----->Process Json files --->Store required data in cosmos db------> Input to application

Above processed data need to join and provide input to the Application.

Cosmos db not fit for above requirement ,looking for another No Sql DB which will fit my requirement.

1 Vote 1 ·
barretodz avatar image
0 Votes"
barretodz answered barretodz edited

You can simulate LEFT JOIN with the EXISTS sentence. Eg:


If SomeCollection node not exists or is null:

 SELECT VALUE c 
 FROM c
 WHERE (
     --Like a "Left Join SomeCollection"
     NOT IS_DEFINED(c.SomeCollection) OR c.SomeCollection = null
     OR EXISTS (
         SELECT null 
         FROM s IN c.SomeCollection
         WHERE s.PropertyName = 'SomeValue'
     )
 )
 --AND/OR Some other c Node conditions
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.