I am working on a spring boot project and using MongoDB as my database.
There is studentDB database which contains a student document and that documents contain the following fields:
_id , student_name, attend_lecture, iso_dom, iso_dow, iso_month, iso_year, iso_week".
student document
_id Object
student_name String
attend_lecture int
iso_dom int date of the month ("1" January 2015)
iso_dow int day of the week (Friday)
iso_month int the month (1 stand for January)
iso_year int year (2015)
iso_week int week number (1)
Here I am trying to retrieve how many students attended lectures in the date range between 12 January 2015 to 13 March 2015?
Methods I have Tried:
I used the aggregation with less than and greater than clause in MongoDB.
I also used the date of the part clause while I retrieved all the dates between 12 January 2015 to 13 March 2015.
Problem: Is there any feasible way to retrieve how many students attended lectures in the date range between 12 January 2015 to 13 March 2015?
Example:
student document
"_id":"5c1639b3a1b32bb04547137f",
"student_name":"MR. Rahul"
"iso_dom":12,
"iso_dow":3,
"iso_month":1,
"iso_week":12,
"isp_year":2018,
"attend_lecture":5
Insert new key date which gives an option to select documents between two dates and using the aggregate function retrieve how many students attended lectures in the date range between 12 January 2015 to 13 March 2015.