Logo

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
Categories
3 categories in total
mongodb
open
springdata
open
springboot
open
Author
8 person written this
loizenai
open
How to use SpringData MongoRepository to interact with MongoDB

https://grokonez.com/spring-framework/spring-data/how-to-use-springdata-mongorepository-to-interact-with-mongdb-springboot-application

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:

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.

SpringData Mongodb - architectures c

II. Practice

More at:

https://grokonez.com/spring-framework/spring-data/how-to-use-springdata-mongorepository-to-interact-with-mongdb-springboot-application

springdata Article's
30 articles in total
Favicon
Handling Asynchronous Execution with Transactions in Spring: A Common Pitfall and How to Solve It
Favicon
Streamlined Java Data Querying
Favicon
Jakarta Persistence API (JPA) example application: Northwind sample database
Favicon
Spring Data JPA: About Specification interface
Favicon
What is implementation class of org.springframework.data.jpa.repository.JpaRepository interface?
Favicon
Spring Data JPA demonstration
Favicon
Spring Data & MongoDB ā€” Pagination+Sorting w/ Aggregation and Lookup
Favicon
Demystifying Spring Data and Spring Data JPA: A Question-Based Guide: Simplify Your Data Access Layer
Favicon
How to Insert Records in Batch with Spring Data
Favicon
Um olhar sobre PagingAndSortingRepository
Favicon
Spring Data JPA Interview Questions and Answers
Favicon
Quick Tip: Kotlin, Spring Data, and Optionals
Favicon
Safely Evolving Database with Liquibase, Spring Data, and Spring Boot
Favicon
How to use Spring Data DynamoDB example | Spring Boot
Favicon
How to start SpringBoot ElasticSearch using Spring Data
Favicon
Apache Solr ā€“ How to start Spring Data Solr with SpringBoot
Favicon
Spring Boot + Angular 6 example | Spring Data + REST + MongoDb CRUD example
Favicon
SpringData Reactive Cassandra Repositories | SpringBoot
Favicon
Spring Data Rest ā€“ How to create a RestAPIs with JPA Many-to-Many relational entities
Favicon
SpringData DynamoDB CRUD Example | SpringBoot
Favicon
Spring Data Rest ā€“ How to create a RestAPIs with JPA One-to-Many relational entities | SpringBoot + MySql + HAL Browser
Favicon
How to access MySQL database with Spring Data Rest application
Favicon
Kotlin Spring Boot + Angular 6 CRUD + PostgreSQL example | Spring Data JPA + REST APIs example
Favicon
Spring Data Redis Messaging ā€“ PubSub example | Spring Boot
Favicon
Spring Data Redis CRUD Operations example with Spring Boot
Favicon
Your own custom Spring Data repository
Favicon
SpringData MongoDB GridFsTemplate to save, retrieve, delete binary files (Image, Text files)
Favicon
How to use SpringData MongoRepository to interact with MongoDB
Favicon
How to start Spring Data Cassandra with SpringBoot
Favicon
Angular + Spring WebFlux + Spring Data Reactive Cassandra example

Featured ones: