spring-boot-mongodb

Installation
SKILL.md

Spring Data MongoDB

MongoDB is a document database, not a relational one wearing a different driver — don't port JPA habits over unchanged. spring-boot-starter-data-mongodb on this skill set's Spring Boot 4.1 baseline pulls in Spring Data MongoDB 4.5.x, which requires MongoDB Java Driver 5.6+ and a MongoDB server in the 6.x–8.x range; verify the project's actual driver/server versions against that if something behaves unexpectedly, since Spring Data no longer supports the older 4.x driver generation.

When MongoDB is (and isn't) the right fit

Reach for it when data is naturally document-shaped (an order with its line items, a user profile with nested preferences), the schema will evolve frequently and a migration-per-change relational workflow is genuine friction, or write throughput on loosely-structured data matters more than complex cross-entity joins. Reach for spring-boot-jpa instead when the domain has many independently-queried, strongly-related entities that need real multi-table joins, strict referential integrity, or ACID transactions spanning many collections as a routine part of normal operation — MongoDB can do transactions (see below) but it's not the tool's strength.

Document modeling

@Document(collection = "orders")
public class Order {
    @Id
    private String id; // Spring Data generates an ObjectId-backed hex string if left null on save

    @Indexed(unique = true)
    private String orderNumber;
Installs
1
First Seen
Sep 9, 2026
spring-boot-mongodb — prabhatkrmishra/spring-boot-production-skills