如何利用spring data mongodb 進(jìn)行多條件查詢
2 回答

翻過(guò)高山走不出你
TA貢獻(xiàn)1875條經(jīng)驗(yàn) 獲得超3個(gè)贊
<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);
- 2 回答
- 0 關(guān)注
- 1922 瀏覽
添加回答
舉報(bào)
0/150
提交
取消