Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use the MongoDB query language to query your relational database, typically from frontend.

License

NotificationsYou must be signed in to change notification settings

mhewedy/spring-data-jpa-mongodb-expressions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java CI with MavencodecovjavadocJoin the chat at https://gitter.im/spring-data-jpa-mongodb-expressions/communityTweet

How it works:

  1. Customize JPA Repository base class:
    @SpringBootApplication@EnableJpaRepositories(repositoryBaseClass =ExpressionsRepositoryImpl.class)publicclassApplication { … }
  2. Change your repository to extendExpressionsRepository:
    @RepositorypublicinterfaceEmployeeRepositoryextendsExpressionsRepository<Employee,Long> {}
  3. Build the controller/service:
    @PostMapping("/search")publicResponseEntity<Page<EmployeeDto>>search(@RequestBodyExpressionsexpressions,Pageablepageable) {returnok().body(employeeRepository.findAll(expressions,pageable).map(employeeMapper::toDto)        );}
  4. SendMongodb query in JSON from frontend:
    {"$or": [    {"lastName":"ibrahim"},    {"$and": [        {"firstName":"mostafa"},        {"birthDate": {"$gt":"1990-01-01"}}      ]    }  ]}

Learn more

For a quick start seethis Medium postordev.to postor seethis demo example on Github.

Seedocumentation website for details about how to get started.

Install:

For spring-boot 3.x:

<dependency>  <groupId>com.github.mhewedy</groupId>  <artifactId>spring-data-jpa-mongodb-expressions</artifactId>  <version>0.1.10</version></dependency>

For spring-boot 2.x:

<dependency>  <groupId>com.github.mhewedy</groupId>  <artifactId>spring-data-jpa-mongodb-expressions</artifactId>  <version>0.0.8</version></dependency>

🎖 Special Thanks

Special thanks toRashad Saif andHamada Elnoby for helping in the design, inspring with ideas, and for doing code review.

In the News

This repo has been mentioned inspring.io weekly news.

About

Use the MongoDB query language to query your relational database, typically from frontend.

Topics

Resources

License

Stars

Watchers

Forks

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp