mondb核心api
和mysql一样需要先定义一个类加上注解@Document("ap_associate_words"),ap_associate_words表示哪个表的名称
- 保存或者修改,该对象有id表示修改,无id表示新增
mongoTemplate.save(保存的对象)
- 查询一个对象
mongotemplate.findById("id",类.class) - 多条件查询
Query query=Query.query(Criteria.where("某个字段").is("值")).with(Sort.by(Sort.Direction.DESC,"某个字段"));
List list=mongoTemplate.find(query,类.class); - 删除
mongoTemplate.remove(Query.query(......))