![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mongodb
兜不兜先生
温故而知新,坚持学习
展开
-
mongo 常用查询代码
1.多条件排序List<Sort.Order> list = new ArrayList<>();list.add(new Sort.Order(Sort.Direction.DESC, "publishTime"));list.add(new Sort.Order(Sort.Direction.ASC, "createTime"));Sort sort = Sort.by( list );2. 多条件查询Query query = new Query();Crite原创 2020-12-04 16:33:39 · 486 阅读 · 0 评论 -
mongo geoNear经纬度的附近按区间聚合搜索
对经纬度建立索引 location:[longitude,latitude]语句:db.noteScore.createIndex({“location”:“2dsphere”})2dsphere index 支持球体的查询和计算,同时它支持数据存储为GeoJSON 和传统坐标封装条件public Query getMoreListQuery(String noteId){ Query query = new Query( ); Criteria cri..原创 2020-11-12 12:42:23 · 610 阅读 · 0 评论