For further reference, please consider the following sections:
- Official Gradle documentation
- Spring Boot Gradle Plugin Reference Guide
- Create an OCI image
- Spring Data MongoDB
The following guides illustrate how to use some features concretely:
These additional references should also help you:
-
Download MongoDB MongoDB Community Server
-
Check mongo version in command prompt/Terminal
- Setting Database Server : Create a folder or directory which will store all the data processed by the mongod
- Install mongoDb Compass to see collection and data
After installation open MongoDB Campass
- You can create database and Collection manually
- Check all databases through command prompt
mongo
- Use database with database name
- Create index
Syntax: db.COLLECTION_NAME.createIndex({KEY:1})
db.student.createIndex({"crTime": 1})
- View index
Syntax: db.COLLECTION_NAME.getIndexes()
db.student.getIndexes()
- create TTL Index
Syntax: db.COLLECTION_NAME.createIndex({"KEY": 1},{expireAfter: "3600s"})
-OR -
db.COLLECTION_NAME.createIndex( { "KEY": 1 }, { expireAfterSeconds: 3600 } )
Example: db.student.createIndex({"crTime": 1},{expireAfter: "3600s"})
Local Swagger UI: http://localhost:8080/swagger-ui/index.html
You can check data in CompassSave Student
Get Students By className
Request payload Response payload
{
"content": [
{
"id": "1971a4ab-5226-4f81-b3fc-ffde69aa8277",
"rollNumber": 1,
"contact": {
"emailId": "[email protected]",
"mobile": "9999999999"
},
"vsningFlds": {
"createdBy": "abc",
"crTime": "2022-09-24T22:34:11.826"
}
},
{
"id": "cdb5d2e7-36ee-40c8-bc66-6eefa5b7d503",
"rollNumber": 2,
"contact": {
"emailId": "[email protected]",
"mobile": "9999999999"
},
"vsningFlds": {
"createdBy": "abc",
"crTime": "2022-09-24T22:37:47.863"
}
},
{
"id": "a3fc979f-3835-4e19-a374-8ca849711144",
"rollNumber": 3,
"contact": {
"emailId": "[email protected]",
"mobile": "9999999999"
},
"vsningFlds": {
"createdBy": "abc",
"crTime": "2022-09-24T22:38:19.39"
}
},
{
"id": "db30ce97-d29b-437f-b754-15354ef8b861",
"rollNumber": 4,
"contact": {
"emailId": "[email protected]",
"mobile": "9999999999"
},
"vsningFlds": {
"createdBy": "abc",
"crTime": "2022-09-24T22:39:24.644"
}
},
{
"id": "c71bc980-1476-474f-a709-43bd1a28f20a",
"rollNumber": 5,
"contact": {
"emailId": "[email protected]",
"mobile": "9999999999"
},
"vsningFlds": {
"createdBy": "abc",
"crTime": "2022-09-24T22:39:50.437"
}
}
],
"pageable": {
"sort": {
"empty": false,
"sorted": true,
"unsorted": false
},
"offset": 0,
"pageNumber": 0,
"pageSize": 10,
"paged": true,
"unpaged": false
},
"last": true,
"totalPages": 1,
"totalElements": 5,
"first": true,
"size": 10,
"number": 0,
"sort": {
"empty": false,
"sorted": true,
"unsorted": false
},
"numberOfElements": 5,
"empty": false
}