• Stars
    star
    90
  • Rank 356,749 (Top 8 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 3 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Spring Data JPA MongoDB Expressions

Java CI with Maven codecov javadoc Join the chat at https://gitter.im/spring-data-jpa-mongodb-expressions/community Tweet

How it works:

  1. Customize JPA Repository base class:
    @SpringBootApplication
    @EnableJpaRepositories(repositoryBaseClass = ExpressionsRepositoryImpl.class)
    public class Application { … }
  2. Change your repository to extends ExpressionsRepository:
    @Repository
    public interface EmployeeRepository extends ExpressionsRepository<Employee, Long> {
    }
  3. Build the controller/service:
    @PostMapping("/search")
    public ResponseEntity<Page<EmployeeDto>> search(@RequestBody Expressions expressions, Pageable pageable) {
    
        return ok().body(
                    employeeRepository.findAll(expressions, pageable).map(employeeMapper::toDto)
            );
    }
  4. Send Mongodb query in JSON from frontend:
    {
      "$or": [
        {"lastName": "ibrahim"},
        {
          "$and": [
            {"firstName": "mostafa"},
            {"birthDate": {"$gt": "1990-01-01"}}
          ]
        }
      ]
    }

Learn more

For quick start see this Medium post or dev.to post or see this demo example on Github.

See documentation website for details about how to get started.

Install:

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

Note: Starting from version 0.1.0 the library supports springboot 3, to use the library with springboot 2 use versions 0.0.x e.g. version 0.0.5.

πŸŽ– Special Thanks

Special thanks to Rashad Saif and Hamada Elnoby for helping in the design, inspring with ideas, and for doing code review.

Next Release

See List of issues to be shipped in the next release

In the News

This repo has mentioned in spring.io weekly news.

Online Validator

see https://expressions-validator.fly.dev/ to help validate expressions

More Repositories

1

vermin

The smart virtual machines manager. A modern CLI for Vagrant Boxes.
Go
127
star
2

SBO-video-extension

Safari Books Online Video Downloder Extension to Google Chrome
JavaScript
110
star
3

spwrap

Simple Stored Procedure call wrapper with no framework dependencies.
Java
24
star
4

mego

The MS Exchange meeting organizer
Go
17
star
5

ObjectMapper

Project used to convert NSDictaionry to Custom user objects.
Objective-C
13
star
6

outbox

Simple (POC) library to implement Outbox microservice pattern
Java
10
star
7

viper

The Smart Virtual Machines Manager
Go
6
star
8

go-gistlog

A Golang Library uses Github Gists as a simple NoSQL database
Go
6
star
9

myApi

golang + echo + gorm + postgres + swaggo
Go
3
star
10

eureka-klient

Kotlin simple eureka client
Kotlin
3
star
11

Sooty

Extensible online searching/streaming Audio player, Initially designed as SouldCloud client for Mac
Objective-C
3
star
12

sftp-utils

Utilities for access sftp via jsch java library
Java
3
star
13

go-redisq

Simple Redis queue lib for golang
Go
3
star
14

jasync

Simple Java async-wait alike on top of CompletableFuture
Java
3
star
15

9to5winawake

Keep your windows machine awake 9to5
Go
2
star
16

primitive-bank

Java
2
star
17

gosse

run sse (server sent event) inside golang on http 1.1 behind nginx reverse proxy exposing http2 to the browser
Go
2
star
18

echox

Extensions for echo the golang web framework
Go
2
star
19

rmq-msg-parser

A Python library for parsing RabbitMQ messages from text file
Python
2
star
20

saudi-city-collector

Collect Saudi City and District geo locations with names from address.gov.sa
Kotlin
1
star
21

classera_session_auto_opener

JavaScript
1
star
22

prog_langs

show relations between different programming languages
Python
1
star
23

free-iptv

Obtains a free iptv URL ... could run in a cron job
Go
1
star
24

movie-rater

Use ocr to extract movie name from image and then search for the movie IMDB rating
Java
1
star
25

moviecrawler

Java library to crawel movie websites and get rating for movies from movie online databases
Java
1
star
26

gitblame

Simple Web Application to list team members contributions
Go
1
star
27

Layin

Simple Layout utility to help you layout your JSP files
Java
1
star
28

echo-gorm-audited-example

Go
1
star
29

shorlty

Short URL using Parse.com and sparkjava
Java
1
star
30

spring-router

spring rails-like router loader (mainly a PoC)
Java
1
star
31

aqarme

Service to query https://sa.aqar.fm/ for certain criteria and notifies me back by Facebook messenger on the list of apartments that matches my criteria.
Java
1
star