Awesome
Demo application for spring-data-jpa-mongodb-expressions
- first run the application
- start sending querying as below
Example queries:
1. find all employees with last name "ibrahim" or firstname is "mostafa" and birthdate after "1990-01-01", sorting by id desc:
URL:
http://localhost:8080/search?sort=id,desc
Request body:
{
"$or": [
{"lastName": "ibrahim"},
{
"$and": [
{"firstName": "mostafa"},
{
"birthDate": {"$gt": "1990-01-01"}
}
]
}
]
}
Screenshot:
<img src="https://github.com/springexamples/spring-data-jpa-mongodb-expressions-demo/raw/master/etc/1.PNG?raw=true" width="700px" />2. find all employees with last name "ibrahim" or department name contains "sw":
URL:
http://localhost:8080/search
Request body:
{
"lastName": "ibrahim",
"department.name": {"$contains": "sw"}
}
<img src="https://github.com/springexamples/spring-data-jpa-mongodb-expressions-demo/raw/master/etc/2.PNG?raw=true" width="700px" />
3. query using curl:
curl -XPOST -d '{"firstName": "fofo"}' -H 'content-type: application/json' http://localhost:8080/search?sort=id,desc | jq