为了账号安全,请及时绑定邮箱和手机立即绑定

如何利用spring data mongodb 进行多条件查询

如何利用spring data mongodb 进行多条件查询

慕容708150 2019-05-14 13:09:06
如何利用spring data mongodb 进行多条件查询
查看完整描述

2 回答

?
幕布斯6054654

TA贡献1876条经验 获得超7个赞

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.6.1.RELEASE</version>
</dependency>

MongoTemplate template = ....;

1
2
3

Criteria criatira = new Criteria();
criatira.andOperator(Criteria.where("userName").is("admin"), Criteria.where("password").is("f818fa8cf51ca364f367f0046bd014ff"));
template.find(new Query(criatira), User.class);




查看完整回答
反对 回复 2019-05-15
  • 2 回答
  • 0 关注
  • 1603 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信