版本:3.8.2
具体代码:
long startTime = System.currentTimeMillis(); Query query = new Query(); query.addCriteria(Criteria.where("infoId").is(6883059)); List<StudentPhysicalInfoDTO> physicalInfoDTOList = mongoTemplate.find(query,StudentPhysicalInfoDTO.class); long endTime = System.currentTimeMillis(); log.info("【查询数据耗时->{},数量->{}】",(endTime-startTime) / 1000,physicalInfoDTOList.size()); Assert.assertNotNull(physicalInfoDTOList);
配置:
data: mongodb: host: localhost port: 27017 database: student_physical password: 123456 username: student_physical
结果:【查询数据耗时->308,数量->3178】
zhangyaoxing 已回答的问题