This challenge is about creating a query language for extracting data from a database (mongodb) via API.
Objective:
- To create a rest API to query customers from a MongoDB database
- The query should be in form of JSON object
- To eliminate the need of writing different APIs for returning different data sets
- To get your hands on latest spring boot framework and practice
Example Database Model – Customer (Mongo):
{ "firstName": "firstName", "lastName": "lastName", "mobile": "mobile", "address":{ "billing": { "address": "address", "location": { "lat": "lat", "long": "long" } }, "shipping": { "address": "address", "location": { "lat": "lat", "long": "long" } } } }
Example Query Model – Query only firstName and lastName
{ "firstName": true, "lastName": true, }
Example Query Model – Query firstName, lastName and mobile
{ "firstName": true, "lastName": true, "mobile": true }
Example Query Model – Query profile and address with only address
{ "firstName": true, "lastName": true, "address":{ "billing": { "address": true, }, "shipping": { address: true, } } }
Example Query Model – get billing address with latitude
{ "firstName": true, "lastName": true, "mobile": true, "address":{ "billing": { "address": true, "location": { "lat": true } } } }
Guidelines:
- API should be spring boot API
- Only Spring Boot – Web, Mongo, Lombok dependencies to be used.
- Mongo mLab cloud instance can be used for the project
- Evaluation will be based on minimum number of LOC
- Evaluation will be based on fastest processing
- No other dependencies to be used
- Use “Spring Initializr” to create spring boot project with Web, Mongo, Lombok dependencies.
- The API should be a POST request with “_query” holding the query json as described above.
Submission Guidelines:
- Github public repository URL
- Total lines of code for entire project including all java files and application.properties
Please post your queries in comments and final submissions to be made by GitHub. Winner will be announced on the blog itself.
Challenge ends on 22nd March 2019
Challenge entry form my side: https://github.com/tony2k84/java-challenge-1903