mongo记录
{
"_id" : ObjectId("5f7066bd96e1084388864d7b"),
"orgCd" : "BJ",
"name" : "记录表"
}
查询ObjectId(id)类型的数据
public void findUser(){
Query query = new Query();
Criteria criatira = new Criteria();
criatira.add(Criteria.where("name").is(name));
criatira.add(Criteria.where("_id").is(new ObjectId(userId)));
query.addCriteria(criatira);
List<User> userList = mongoTemplate.find(query, User.class, "user");
}

浙公网安备 33010602011771号