建设收费网站,常德公司做网站,网站空白模板下载,设计网站名称DBref文档关联#xff0c;在按该类型查询的时候#xff0c;在字段名后加上关联表的字段名即可#xff0c;如#xff1a;Criteria.where(bloggroup.$id)#xff0c;$id代表关联表的oid字段。or和and联合查询比如查询 (A 1 and b 2 )or (A 3 and b 4)#x…DBref文档关联在按该类型查询的时候在字段名后加上关联表的字段名即可如Criteria.where(bloggroup.$id)$id代表关联表的oid字段。or和and联合查询比如查询 (A 1 and b 2 )or (A 3 and b 4)or的数量不确定那么采用定义一个Criteria数组将条件组记入数组中然后将数组指定给orCriteria方法。Overridepublic List find(List groupattentions) {Query query new Query();Criteria criteria new Criteria();Criteria[] criterialist new Criteria[groupattentions.size()];for(int i0;iCriteria criteriaand new Criteria();criteriaand.andOperator(Criteria.where(bloggroup.$id).is(new ObjectId(groupattentions.get(i).getGroupid())).and(bloglevel).gte(groupattentions.get(i).getGrouplevel()));criterialist[i] criteriaand;}criteria.orOperator(criterialist);query.addCriteria(criteria);return mongoTemplateDataBase.find(query, Blog.class);}