SPRING CONCEPTS

MongoDB

Spring Concepts / MongoDB

MongoDB stores BSON documents in collections inside databases.

Understand the idea

A todo document has fields such as _id, title, and completed. Spring Data maps Java objects to those documents. Collections do not require relational @Entity mappings or JDBC SQL. A single-document write is atomic; a separate read and save can still encounter competing edits.

A concrete example

{
  "_id": "generated identifier",
  "title": "Teach Spring",
  "completed": false
}

In the application

The three labs use separate databases: todo_mvc, todo_rest, and todo_personal.

A document database still needs schema decisions, validation, indexes, and access controls.

See it in a working stage

Related concepts

Read the official documentation ↗
Java 21 · Spring Boot 4.1.1 · Edupoly