mongoDB and条件查询

刺骨的言语ヽ痛彻心扉 2021-12-12 10:09 454阅读 0赞
  1. Criteria criteria = Criteria.where("createTime").lte(new Date());
  2. Query query = new Query();
  3. if (bo.getScope() != null && bo.getScopeId() != null) {
  4. criteria.and("scope").is(bo.getScope()).and("scopeId").is(bo.getScopeId());
  5. }
  6. query.addCriteria(criteria);
  7. query.with(new Sort(Sort.Direction.DESC, "_id"));
  8. List<Person> persons= meerkatMinMongoTemplate.find(query, Person.class);

发表评论

表情:
评论列表 (有 0 条评论,454人围观)

还没有评论,来说两句吧...

相关阅读