Skip to content
This repository was archived by the owner on Aug 29, 2024. It is now read-only.
This repository was archived by the owner on Aug 29, 2024. It is now read-only.

Are multiple types within one container supported? #563

@KnyGoo

Description

@KnyGoo

Hi,

Is there support for multiple object types within one container? If there is, how to handle transaction management for this? After reading CosmosDB documentation, this approach is recommended when objects share the same partition key. I want to do this because I need to persist multiple objects within one transaction and following CosmosDB documentation they need to be in the same logical partition therefore:

"Only documents from the same logical partition can participate in a single transaction. Consequently, writes to different containers can’t be a part of the same transaction."

Example of one container from Cosmos DB documentation:
`
{
"id": "",
"type": "post",
"postId": "",
"userId": "",
"title": "",
"content": "",
"creationDate": ""
}

{
"id": "",
"type": "comment",
"postId": "",
"userId": "",
"content": "",
"creationDate": ""
}

{
"id": "",
"type": "like",
"postId": "",
"userId": "",
"creationDate": ""
}
`
Is it possible to have a Post, Comments and Like repository? Can I set the type anywhere?

Personal example:
I have documents en batches. A batch can have a lot of documents (1-N). When I receive a document I would like to create the document and upsert the batch. The reason I would like to upsert the batch is to avoid complex queries afterwards and to work event driven (once I have all documents I will start processing the batch).

With kind regards,

Kenny

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions