This repository contains code samples for the Quick Start blog post series.
You can read more about the Quick Start series on the MongoDB blog Quick Start section.
To get started with MongoDB Atlas and get a free cluster read this blog post.
- Java JDK 8 to 13.
- Maven 3.6.2.
- Compile:
mvn clean compile
- Run the
HelloMongoDB
class:
mvn compile exec:java -Dexec.mainClass="com.mongodb.quickstart.HelloMongoDB"
- Run the
Connection
class:
mvn compile exec:java -Dexec.mainClass="com.mongodb.quickstart.Connection" -Dmongodb.uri=mongodb+srv://USERNAME:PASSWORD@cluster0-abcde.mongodb.net/test?w=majority
- Run the
Create
class:
mvn compile exec:java -Dexec.mainClass="com.mongodb.quickstart.Create" -Dmongodb.uri=mongodb+srv://USERNAME:PASSWORD@cluster0-abcde.mongodb.net/test?w=majority
- Run the
Read
class:
mvn compile exec:java -Dexec.mainClass="com.mongodb.quickstart.Read" -Dmongodb.uri=mongodb+srv://USERNAME:PASSWORD@cluster0-abcde.mongodb.net/test?w=majority
Maxime Beugnet maxime@mongodb.com