question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for Cosmos DB and possibly other NoSQL databases

See original GitHub issue

Situation

JADNC provides excellent support for relational databases out of the box. However, the support for NoSQL databases such as Cosmos DB or MongoDB is comparably limited. For example, while there is an EF Core provider for Cosmos DB, that provider does not support joins, meaning that certain requests will lead to runtime errors. Owing to the limitations of MongoDB, the MongoRepository<TResource, TId> provided by JsonApiDotNetCore.MongoDb also does not support relationships.

What would be great?

It would be great to have better support for NoSQL databases in JADNC. In the ideal case (in practice where reasonably possible), JADNC would offer the same API features (e.g., support for relationships) that are currently offered for SQL databases.

Status

I have implemented an IResourceService<TResource, TId> for Cosmos DB (and possibly other NoSQL databases such as MongoDB) that supports relationships. It deals with secondary and included resources so that the IResourceRepository<TResource, TId> does not have to handle includes or joins. Apart from that IResourceService<TResource, TId>, I implemented a very slim IResourceRepository<TResource, TId> that provides a workaround for exceptions thrown by the DeleteAsync() method in certain cases. Otherwise, there are actually no dependencies on Cosmos DB specifically, meaning that only a database-specific IResourceRepository<TResource, TId> implementation would be required to add support for the next NoSQL database.

Question

Would you be interested in adding this IResourceService<TResource, TId> implementation to JADNC? I would love to contribute back to this project.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
maureicommented, Nov 19, 2021

Hi @ThomasBarnekow, I’ve been following your updates closely. I’m currently working on introducing non-nullable reference types into the openapi branch which has proven to be quite a demanding task. Once I’ve finished this, your PR is up next on my list. Thanks again for getting involved, we’re both happy to see the increase in community involvement!

0reactions
ThomasBarnekowcommented, Nov 18, 2021

Hi @bart-degreed and @maurei, I would be really keen on getting some feedback on my PR now. I’ve added instructions (in the PR), an example (CosmosDbExample), and a set of integration Tests (CosmosDbTests).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Cosmos DB - NoSQL and Relational Database
Azure Cosmos DB is a fully managed NoSQL and relational database for modern app development. Start building applications with a free trial.
Read more >
NoSQL Databases with Azure Cosmos DB
Azure Cosmos DB is a Microsoft Azure database service that supports multiple NoSQL models and is available globally. Additional to Azure Cosmos ...
Read more >
Introduction to NoSQL in Cosmos DB - Cloud References
Cosmos DB is a multi-model database service, and therefore it supports different non-relational models, which we will analyze later. Let's perform a bottom-to- ......
Read more >
CosmosDB: Is It a Good Alternative to Relational Databases?
Azure Cosmos DB is a globally distributed, and multi-model NoSQL database service with a transparent multi-master replication and turnkey ...
Read more >
Introduction to SQL for Cosmos DB - Simple Talk
This article by Adam Aspin reviews the Azure Cosmos DB SQL API from the perspective of the relational database developer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found