liveBook · Manning

MongoDB

As explained in Java Persistence with Spring Data and Hibernate epub

MongoDB is a document-oriented database management system that stores data in flexible, JSON-like documents.

MongoDB is an open-source, document-oriented NoSQL database that stores information as JSON-like documents organized into databases and collections. Documents in one collection may have different fields and value types, enabling dynamic schemas. section 17.1

MongoDB organizes persisted data through three core levels:

  • A database contains collections. section 17.1
  • A collection contains documents and roughly corresponds to a relational table. section 17.1
  • A document contains key/value fields and roughly corresponds to a relational row; fields need not be uniform across documents. section 17.1

Java applications can access MongoDB through Spring Data MongoDB, which supplies repositories, object mapping, annotations, derived queries, Spring integration, and Spring Boot support. A domain class can use @Document, @Id, @Indexed, compound-index annotations, @Transient, and @PersistenceConstructor to control persistence. section 17.2

User document and query

A CaveatEmptor user document stores fields such as username, firstName, lastName, registrationDate, email, level, and active, together with MongoDB's generated _id. MongoDB Compass can filter the collection with {"username":"john"}. section 17.1

MongoDB can also sit behind Hibernate OGM, allowing entities mapped with JPA annotations to be persisted and queried through EntityManager and JPQL. Tests create collections and documents, use transaction boundaries even for reads, and clean persisted entities afterward. section 18.2.3 section 18.4

How Java Persistence with Spring Data and Hibernate epub covers it

How deep it goes
Defines databases, collections, documents, fields, dynamic schemas, queries, indexes, and Java mappings, but defers comprehensive CRUD detail.
Examples
Uses a user document, MongoDB Compass filters, Spring Boot mappings, and Hibernate OGM tests with User, Item, and Bid entities.
What it assumes
Assumes basic relational database terminology and Java persistence familiarity while defining MongoDB's document model explicitly.
What you can do after
Operate/configure MongoDB through Compass, Spring Boot properties, Spring Data mappings, or JPA and JPQL persistence tests.
How it connects
Connects NoSQL, JSON, collections, documents, relational databases, Spring Data MongoDB, JPA, JPQL, and Hibernate OGM.

Also explained in

Compare how 7 books explain MongoDB →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Java Persistence with Spring Data and Hibernate epub. The section links point to the parts of the book it draws on.