java spring
Query query = new Query();Criteria criteriaSn = Criteria.where("sn").is(sn);Criteria criteriaTime = Criteria.where("createTime").gte(timeBegin).lte(timeEnd);query.addCriteria(criteriaSn);query.addCriteria(criteriaTime);//指定返回字段query.fields().include("sLat");query.fields().include("sLon");query.fields().include("GLat");query.fields().include("GLon");query.fields().include("createTime"); System.out.println(query.toString());//query.addCriteria(criteriaGLon.orOperator(criteriaSLon));//正序query.with(new Sort(new Order(Direction.ASC, "createTime"))); List<DeviceData> list = mongoTemplate.find(query, DeviceData.class,"deviceData");
原文地址:https://www.cnblogs.com/zhuangyao/p/10840382.html
时间: 2024-10-13 19:52:45