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
Create
class:
mvn spring-boot:run -Dspring-boot.run.arguments=create
- Run the
Read
class:
mvn spring-boot:run -Dspring-boot.run.arguments=read
- Run the
Update
class:
mvn spring-boot:run -Dspring-boot.run.arguments=update
- Run the
Delete
class:
mvn spring-boot:run -Dspring-boot.run.arguments=delete
- Run the
MappingPOJO
class:
mvn spring-boot:run -Dspring-boot.run.arguments=mapping