时间:2021-07-01 10:21:17 帮助过:50人阅读
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");
mongoDB projection 指定字段返回
标签:end project device 返回 find direction add class ring