Home > front end >  Design pattern to connect spring and MongoDB
Design pattern to connect spring and MongoDB

Time:10-15

I am new to Spring Boot and I saw a concept of DAO or JPA that helps us to use Relational databases. But in my case I want to use mongo-DB so is there a particular design pattern with spring that I should be using in order to perform CRUD operations?

What design patterns are generally used?

In case there is no such design pattern then what could be the best way to be performing CRUD operations using MongoDB?

Also are there any tools or standards that helps us connect java application to a NoSQL database?

CodePudding user response:

JPA is for NoSQL database too.

CodePudding user response:

This may interest you: Spring Boot Integration with MongoDB Tutorial

CodePudding user response:

The MongoTemplate follows the standard template pattern in Spring and provides a ready-to-go, basic API to the underlying persistence engine.

The repository follows the Spring Data-centric approach and comes with more flexible and complex API operations, based on the well-known access patterns in all Spring Data projects.

For both, we need to start by defining the dependency — for example, in the pom.xml, with Maven

You can learn about how you can use mongo db with spring boot and how to configure your application from the below link in detail https://www.baeldung.com/spring-data-mongodb-tutorial

  • Related