MongoDB

Follow the instructions at http://docs.mongodb.org/manual/installation/ to install MongoDB on your specific operating system.

To get started with connecting to MongoDB, include the dependency for Spring Boot MongoDB starter in the pom.xml:

    <dependency>      <groupId>org.springframework.boot</groupId>      <artifactId>spring-boot-starter-data-mongodb</artifactId>    </dependency>

Let's create a new Entity class Person to store to MongoDB. The following snippet shows a Person class with an ID and a name:

    public class Person {      @Id      private String id;      private String name;      public Person() {// Make JPA Happy      }    public Person(String name) {      super();      this.name = name;     }   }

We would want to store the Person entities to MongoDB. We would need to create a ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.