【发布时间】:2020-07-08 05:43:05
【问题描述】:
我在 fromdate 和 todate 之间从 MongoDB 获取文档。所有文档中都有一个名为“lastActive”的字段。 lastActive 字段是 mongodb 文档中的日期字符串。我需要将 lastActive 字段文档与大于 fromDate 和小于 toDate 进行比较。我不知道如何在 SpringBoot 中编写查找查询,我已经写过,但给出的记录为零。
Active_userlist=profile_collection.find(Filters.and(Filters.gte("lastActive",
fromDate),Filters.lte("lastActive",toDate))).into(new ArrayList<Document>));
有人可以帮我在日期范围内获得适当的文件吗? 注意:我是用postman调用这个API的,我在postman的ResponseBody中提供了fromdate和todate。
【问题讨论】:
标签: mongodb spring-boot arraylist