【发布时间】:2019-11-25 17:42:33
【问题描述】:
下面是我的代码 -
MatchOperation match_Status_Count = new MatchOperation(
Criteria.where("date1").gte("2019-3-25T17:34:24.734Z").andOperator(
Criteria.where("date1").lte("2019-11-25T17:34:24.734Z")
));
GroupOperation group_Status_Count = Aggregation.group("Status").count().as("Statuscount");
Aggregation aggregate_Status_Count = Aggregation
.newAggregation(match_Status_Count, group_Status_Count)
.withOptions(new AggregationOptions(false, false,
new BasicDBObject(new Document().append("batchSize", 100000000000L))));
;
AggregationResults<ARStructData> orderAggregate_Status_Count = mongoTemplate
.aggregate(aggregate_Status_Count, D_AR_COLLECTION_NAME, ARStructData.class);
由于日期存储为字符串,因此根据字符串gte和lte返回。 如果有人给我解决方案,我们将不胜感激。
【问题讨论】:
-
所以您希望能够说“给我两个日期之间的文档,其中输入日期是实际日期对象,但文档中的日期是字符串”?
-
现在输入日期不是实际的日期对象,而只是字符串。但是修改它也不起作用。是的,文档中的日期是一个字符串
标签: mongodb spring-boot spring-mongodb