Reputation: 11
I have Document db and I have a scenario where I'm going to join two collections for required result, but I'm not able to join two collections.
This is the simple select query to get records:
SELECT
c.DocumentName,
c.DocumentID,
c.VersionID,
c.VersionName,
c.PageID,
c.OCRSpan
FROM c
where ARRAY_CONTAINS([4780,4779], c.VersionID)
var endpoint = ConfigurationManager.AppSettings["DocDbEndpoint"];
var masterKey = ConfigurationManager.AppSettings["DocDbMasterKey"];
using (var client = new DocumentClient(new Uri(endpoint), masterKey))
{
FeedOptions queryOption = new FeedOptions { MaxItemCount = 100 };
int[] ids = { 4779 };
//Execute Store Procedure
var result = await client.ExecuteStoredProcedureAsync<string>("dbs/HOCRData/colls/HOCR/sprocs/getData/", new RequestOptions() { PartitionKey = new PartitionKey(Undefined.Value) }, ids);
Console.WriteLine($" {result.Response} ");
Console.ReadKey();
...
The code mentioned is only for a single collection, but I'm expecting to join two collections together.
Or is there any alternate way to join two collection documents?
Upvotes: 1
Views: 5458
Reputation: 8515
You cannot join collections in Cosmos DB.
As for alternates, you have a few options that all require some significant changes:
Upvotes: 4