A Java 21 utility for generating and inserting test product data into MongoDB Atlas.
Product Data Seeder was built as part of JavaLabs.io to generate a large dataset for testing REST API performance with APILoadGenAI.
It connects to MongoDB Atlas and inserts 10,000 generated products into the productdb.products collection.
- Java 21
- Maven
- MongoDB Atlas
- MongoDB Java Driver
- dotenv-java
Each generated product contains:
nameprice
Example:
{
"name": "Product-1",
"price": 110.5
}Generate Products
↓
Create MongoDB Documents
↓
Batch with insertMany()
↓
MongoDB Atlas
↓
productdb.products
The seeder generates products from Product-1 through Product-10000 and inserts them using MongoDB's insertMany() operation.
Create a .env file in the project root:
MONGODB_URI=your_mongodb_connection_string
The .env file is excluded through .gitignore and should never be committed.
Compile:
mvn compileRun:
mvn exec:java "-Dexec.mainClass=com.javalabs.seeder.ProductDataSeeder"The utility connects to MongoDB Atlas and inserts the generated product dataset into the products collection.
APILoadGenAI needs a sufficiently large dataset to test how a REST API behaves under load.
Instead of manually creating thousands of products through Postman, this utility provides a simple way to generate test data programmatically.
The resulting dataset is used by ProductAPI as the backend target for APILoadGenAI performance experiments.
Part of JavaLabs.io, a collection of Java-first experiments focused on building and understanding backend systems.