![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mongodb
零时★
这个作者很懒,什么都没留下…
展开
-
Spring Data MongoDB 使用多字段排序
直接在Query里面添加with,即可,例如 //rank排序 Sort rankSort = new Sort(Sort.Direction.ASC, rankField); //创建时间排序 Sort createDateSort = new Sort(Sort.Direction.DESC, FIELD_CREATE_DATE); Query query = Query.query(criteria); query.with(rankSort).with(c原创 2020-07-08 10:53:22 · 3287 阅读 · 1 评论 -
Spring Data MongoDB 的使用
前期准备 maven配置 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> mongodb配置 spring: data: mongodb: host: 127.0.原创 2020-06-22 14:38:52 · 335 阅读 · 0 评论 -
MongoDB 常用 Shell 命令
MongoDB 常用 Shell 命令 根据ID查询 db.document.findOne({_id: ObjectId("")}); 按属性查询 db.document.find({"": "", "": ""}); 或查询 db.document.find({ $or: [ {"": ""}, {"": ""} ] }); 只查询需要的字段 db.document.find({}, {id: 1, '': 1}); 过滤不需要的字段 db.document.find({}, {i原创 2020-06-22 14:15:08 · 421 阅读 · 0 评论