(51L).equals(eventRecord.getEventType());
有人可能认为在Java中写入newBigDecimal(0.1)所创建的BigDecimal正好等于 0.1(非标度值 1,其标度为 1),但是它实际上等于
0.1000000000000000055511151231257827021181583404541015625,这是因为0.1无法准确地表示为 double(或者说对于该情况,不能表示为任何有限长度的二进制小数)
BigDecimal bd1 = BigDecimal.valueOf(12.3);
// 12.3
BigDecimal bd2 = new BigDecimal(12.3);
// 12.300000000000000710542735760100185871124267578125
int sum = (int) mongoTemplate.count(query, "Prepaid_HistoryData");
实际语句
{"aggregate": "Prepaid_HistoryData", "pipeline": [{"$match": {"meterNo": "00011469_1_5", "$and": [{"createTime": {"$gte": {"$date": "2023-11-30T16:00:00Z"}}}, {"createTime": {"$lte": {"$date": "2024-01-01T05:32:52Z"}}}]}}, {"$group": {"_id": 1, "n": {"$sum": 1}}}], "cursor": {}, "$db": "iot"}
想看实际执行的mongo语句 yml文件中添加
logging:
level:
org:
mongodb:
driver: DEBUG