This repository contains code samples for the Quick Start blog post series.
You can read more about the Quick Start series on the MongoDB Developer Hub.
To get started with MongoDB Atlas and get a free cluster read this blog post.
- Java 21
- Maven 3.8+
Add MongoDB Atlas Cluster URI in # src/main/resources/application.properties:
spring.data.mongodb.uri=mongodb+srv://<user>:<password>@<Cluster>/?retryWrites=true&w=majority
- Compile:
mvn clean compile- Run the
Createclass:
mvn spring-boot:run -Dspring-boot.run.arguments=create- Run the
Readclass:
mvn spring-boot:run -Dspring-boot.run.arguments=read- Run the
Updateclass:
mvn spring-boot:run -Dspring-boot.run.arguments=update- Run the
Deleteclass:
mvn spring-boot:run -Dspring-boot.run.arguments=delete- Run the
MappingPOJOclass:
mvn spring-boot:run -Dspring-boot.run.arguments=mappingFor this session make sure to switch to the sample_supplies database in your application.properties.
- Run the
TotalSalesByLocationServiceclass:
mvn spring-boot:run -Dspring-boot.run.arguments=total-sales-by-location- Run the
AverageCustomerSatisfactionServiceclass:
mvn spring-boot:run -Dspring-boot.run.arguments=average-customer-satisfaction- Run the
AverageItemPricePerStoreServiceclass:
mvn spring-boot:run -Dspring-boot.run.arguments=average-item-price-per-store- Run the
CountDistinctCustomersServiceclass:
mvn spring-boot:run -Dspring-boot.run.arguments=count-distinct-customers- Run the
TotalSalesByDayOfWeekServiceclass:
mvn spring-boot:run -Dspring-boot.run.arguments=total-sales-by-day-of-week- Run the
RevenueByLocationServiceclass:
mvn spring-boot:run -Dspring-boot.run.arguments=revenue-by-location- Run the
SalesPerformanceServiceclass:
mvn spring-boot:run -Dspring-boot.run.arguments=sales-performance