Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CosmosClient vs DocumentClient

What's the difference between CosmosClient and DocumentClient, in Java. Should I prefer one over the other, and why?

like image 667
so-random-dude Avatar asked Nov 25 '25 05:11

so-random-dude


1 Answers

Simply put, CosmosClient is part of new SDK for Azure Cosmos DB SQL API while DocumentClient is part of the old SDK (when Cosmos DB SQL API was called DocumentDB).

Old SDK Github Repo: https://github.com/Azure/azure-documentdb-java

New SDK Github Repo: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-cosmos

Other big difference is the the new SDK supports both async and sync whereas the older SDK only supports sync.

Considering the old SDK has not been updated in quite some time, the recommendation would be to use the newer one.

like image 190
Gaurav Mantri Avatar answered Nov 28 '25 01:11

Gaurav Mantri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!