Azure Cosmos DB is a globally distributed multi-model database. One of the supported APIs is the MongoDB API, which provides a document model and support for client drivers in many platforms. This sample shows you how to use Azure Cosmos DB with MongoDB API from a Springboot MongoDB application. It also illustrates how to configure read preference for different repositories.
Running this sample
Before you can run this sample, you must have the following prerequisites:
Then, clone this repository.
Next, substitute the
spring.data.mongodb.uriin src\main\resources\application.properties with your Cosmos DB account's values.
Run your application.
About the code
The code included in this sample is intended to illustrate using Azure Cosmos DB with the MongoDB API from SpringBoot MongoDB application. It is a port of the sample from SpringBoot Getting Started article. It also uses code from this tutorial to configure read preference for different repositories.