Java 如何在Spring Boot中使用特定的日期范围和聚合从MongoDB数据库检索数据?
我正在从事一个spring启动项目,并使用MongoDB作为我的数据库 studentDB数据库包含一个学生文档,该文档包含以下字段: _id、学生姓名、参加讲座、iso dom、iso dow、iso月、iso年、iso周” 学生文件Java 如何在Spring Boot中使用特定的日期范围和聚合从MongoDB数据库检索数据?,java,mongodb,spring-boot,microservices,aggregation,Java,Mongodb,Spring Boot,Microservices,Aggregation,我正在从事一个spring启动项目,并使用MongoDB作为我的数据库 studentDB数据库包含一个学生文档,该文档包含以下字段: _id、学生姓名、参加讲座、iso dom、iso dow、iso月、iso年、iso周” 学生文件 _id Object student_name String attend_lecture int iso_dom int date of the month ("1" January
_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)
"_id":"5c1639b3a1b32bb04547137f",
"student_name":"MR. Rahul"
"iso_dom":12,
"iso_dow":3,
"iso_month":1,
"iso_week":12,
"isp_year":2018,
"attend_lecture":5
在这里,我试图检索2015年1月12日至2015年3月13日期间有多少学生参加了讲座
我尝试过的方法:
_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)
"_id":"5c1639b3a1b32bb04547137f",
"student_name":"MR. Rahul"
"iso_dom":12,
"iso_dow":3,
"iso_month":1,
"iso_week":12,
"isp_year":2018,
"attend_lecture":5
插入新的关键日期,该日期提供选择两个日期之间的文档的选项,并使用聚合函数检索2015年1月12日至2015年3月13日期间的上课人数