dev-resources.site
for different kinds of informations.
How to use SpringData MongoRepository to interact with MongoDB
Published at
4/9/2021
Categories
mongodb
springdata
springboot
Author
loizenai
Author
8 person written this
loizenai
open
How to use SpringData MongoRepository to interact with MongoDB
How to use SpringData MongoRepository to interact with MongoDB
In the past post, we had learned how to work with MongoDB by MongoOperations which supports a set of standard APIs to manipulate data. So in the tutorial, JavaSampleApproach will show a powerful tool SpringData MongoRepository with flexible and more complex APIs to interact with MongoDB.
Related articles:
- Spring MongoOperations to access MongoDB
- How to build SpringBoot MongoDb RestfulApi
- SpringData MongoDB GridFsTemplate to save, retrieve, delete binary files (Image, Text files)
- Angular 4 + Spring Boot + MongoDB CRUD example
- Spring Boot + Angular 6 example | Spring Data + REST + MongoDb CRUD example
I. Technologies
ā Java: 1.8
ā Maven: 3.3.9
ā Spring Tool Suite: Version 3.8.4.RELEASE
ā Spring Boot: 1.5.4.RELEASE
- MongoDB: v3.4.1
I. MongoRepository
MongoRepository is implemented with lots of APIs to store and retrieve data. We can use MongoRepository with full generic CRUD operations of CrudRepository interface, and additional methods of PagingAndSortingRepository interface for pagination and sorting. MongoRepository also extends QueryByExampleExecutor so it allows execution of Query by Example.
public interface MongoRepository
extends PagingAndSortingRepository, QueryByExampleExecutor {
...
public interface PagingAndSortingRepository extends CrudRepository {
-> With a strong set of APIs, We should start Spring MongoRepository to manipulate data from MongoDB.
II. Practice
More at:
springdata Article's
30 articles in total
Handling Asynchronous Execution with Transactions in Spring: A Common Pitfall and How to Solve It
read article
Streamlined Java Data Querying
read article
Jakarta Persistence API (JPA) example application: Northwind sample database
read article
Spring Data JPA: About Specification interface
read article
What is implementation class of org.springframework.data.jpa.repository.JpaRepository interface?
read article
Spring Data JPA demonstration
read article
Spring Data & MongoDB ā Pagination+Sorting w/ Aggregation and Lookup
read article
Demystifying Spring Data and Spring Data JPA: A Question-Based Guide: Simplify Your Data Access Layer
read article
How to Insert Records in Batch with Spring Data
read article
Um olhar sobre PagingAndSortingRepository
read article
Spring Data JPA Interview Questions and Answers
read article
Quick Tip: Kotlin, Spring Data, and Optionals
read article
Safely Evolving Database with Liquibase, Spring Data, and Spring Boot
read article
How to use Spring Data DynamoDB example | Spring Boot
read article
How to start SpringBoot ElasticSearch using Spring Data
read article
Apache Solr ā How to start Spring Data Solr with SpringBoot
read article
Spring Boot + Angular 6 example | Spring Data + REST + MongoDb CRUD example
read article
SpringData Reactive Cassandra Repositories | SpringBoot
read article
Spring Data Rest ā How to create a RestAPIs with JPA Many-to-Many relational entities
read article
SpringData DynamoDB CRUD Example | SpringBoot
read article
Spring Data Rest ā How to create a RestAPIs with JPA One-to-Many relational entities | SpringBoot + MySql + HAL Browser
read article
How to access MySQL database with Spring Data Rest application
read article
Kotlin Spring Boot + Angular 6 CRUD + PostgreSQL example | Spring Data JPA + REST APIs example
read article
Spring Data Redis Messaging ā PubSub example | Spring Boot
read article
Spring Data Redis CRUD Operations example with Spring Boot
read article
Your own custom Spring Data repository
read article
SpringData MongoDB GridFsTemplate to save, retrieve, delete binary files (Image, Text files)
read article
How to use SpringData MongoRepository to interact with MongoDB
currently reading
How to start Spring Data Cassandra with SpringBoot
read article
Angular + Spring WebFlux + Spring Data Reactive Cassandra example
read article
Featured ones: