当前位置: 首页 > news >正文

高端网站建设公建站模板网站

高端网站建设公,建站模板网站,wordpress顶踩仿织梦,html怎么做网站首页1.【报错】sort operation used more than the maximum 33554432 bytes of RAM. Add an index MongoDB 排序超过内存限制,限制最大为100M。 解决方式:将内存排序改为磁盘排序 正常用法:数据量大了再排序会报错 Autowired protected MongoO…

1.【报错】sort operation used more than the maximum 33554432 bytes of RAM. Add an index

MongoDB 排序超过内存限制,限制最大为100M。
解决方式:将内存排序改为磁盘排序

正常用法:数据量大了再排序会报错

@Autowired
protected MongoOperations mongoTemplate;public List<Student> getStudent(Long cid, Integer pageNo, Integer pageSize){Sort sort = new Sort(new Sort.Order(Sort.Direction.DESC,"createTime"));Query query = Query.query(Criteria.where("cid").is(cid)).with(sort);if (pageNo != null && pageSize != null) {query.with(PageRequest.of(pageNo - 1, pageSize));}List<Student> students = mongoTemplate.find(query, Student.class).stream().limit(100).collect(Collectors.toList());
}

优化方法:采用磁盘查询

import com.iqiyi.student.entity.mongo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.aggregation.*;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;import java.util.List;@Repository
public class StudentMongoDao{@Autowiredprivate MongoTemplate mongoTemplateOrigin;protected Class<T> entityClass;public List<Student> getStudent(Long cid, Integer pageNo, Integer pageSize){MatchOperation matchOperation = Aggregation.match(Criteria.where("cid").is(cid));SortOperation sortOperation = Aggregation.sort(Sort.by(Sort.Direction.DESC, "createTime"));Aggregation aggregation = Aggregation.newAggregation(matchOperation, sortOperation);// 如果需要分页if (pageNo != null && pageSize != null) {Pageable pageable = PageRequest.of(pageNo - 1, pageSize);SkipOperation skipOperation = Aggregation.skip((long) pageable.getPageNumber() * pageable.getPageSize());LimitOperation limitOperation = Aggregation.limit(pageable.getPageSize());aggregation = Aggregation.newAggregation(matchOperation, sortOperation, skipOperation, limitOperation);}// 查询Aggregation finalAggregation = aggregation.withOptions(Aggregation.newAggregationOptions().allowDiskUse(true).build());List<Student> students= mongoTemplateOrigin.aggregate(finalAggregation, entityClass.getAnnotation(Document.class).collection(), entityClass).getMappedResults();return students;}
}

2.【报错】Map key xxx.xxx contains dots but no replacement was configured

原因:mongoDb有自己的内容解析方式,不支持内容中出现"."(英文点号)。
解决:将该符号替换掉即可

update 2025.1.3

http://www.yayakq.cn/news/383726/

相关文章:

  • 公司网站建设费计入什么科目泗洪做网站公司
  • 青岛网站建设服务器廊坊网站推广排名
  • 钦州建设银行社招聘网站云南技术支持热搜科技
  • 佛山网站建设seo优化怎么找做企业网站的
  • 平昌县建设局网站邯郸建设网
  • 怎么做网站或APPvs手机网站开发
  • 哈尔滨网建公司有哪些seo整站优化外包
  • 网站密钥怎么做网易企业邮箱收费吗
  • 成都网站建设模板制作寿光做网站
  • 网站备案的重要性WordPress怎样创建登录页面
  • 网站怎么做百科青岛网络推广方案服务
  • 网站推广seo蜘蛛屯优化排名图案设计制作
  • 江苏省网站备案电话号码网站开发知识
  • 网站开发用什么图片格式最好电商联盟推广
  • 助孕网站优化推广教育平台网站建设
  • 聊城集团网站建设公司甘肃省路桥建设集团网站
  • 购物网站是多少wordpress主题ux themes
  • 专业建设 教学成果奖网站wordpress模板目录结构
  • 网站运营策略成都网站建设外包
  • 什么都能买到的网站我想做一个网站怎么做的
  • 二手交易网站怎么做google企业网站seo
  • 网站建设经费估算天元建设集团有限公司发展历程
  • 一个公司设计网站怎么做外贸原单童装哪个网站做
  • 做网站后台维护的岗位叫什么wordpress 文章筛选
  • 贵阳网站开发哪家专业优化品牌seo关键词
  • 网站建设 电子商务网站开发吴川网站建设
  • 做网站的样版天津网站建设索王道下拉
  • 做flash网站框架引擎app开发成本预算表
  • 大连工商网站查询企业信息一套完整的vi设计手册
  • 网站开发技术部分工会网站建设可以