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

盐城网站制作百度推广开户渠道

盐城网站制作,百度推广开户渠道,wordpress段落间距调整,淮北11月19日报告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.yidumall.com/news/26827.html

相关文章:

  • 廊坊网站建设什么是互联网营销
  • 地方网站自助建站企业推广软文范文
  • 书签制作方法图片大全seo资料
  • 私人制定网站下载百度app下载
  • 鄂州网站建设设计职业技能培训学校
  • 门类细分网站长尾词挖掘工具
  • 大兴网站建设推广seo网站外链工具
  • 西斗门的网站建设台州seo快速排名
  • 网站制作域名是免费的吗校园推广的方式有哪些
  • 做网站学习关键词排名点击
  • 四川网站推广优化手机性能的软件
  • 网站所属权百度网站怎么申请注册
  • 工信部网站 登陆近三天时政热点
  • 低价虚拟主机山东网络推广优化排名
  • 最简单网站设计的代码百度竞价搜索
  • 付费阅读网站代码文案写作软件app
  • 国外的室内设计网站武汉seo优化
  • 自己做网站用什么软件下载大数据比较好的培训机构
  • 昆明建设银行纪念币预约网站站长之家官网登录入口
  • 做网站需要空间竞价外包代运营公司
  • php做的网站模板下载百度热搜的含义
  • 网站建设代码走查销售成功案例分享
  • 广州手机网站建设联系电话西安网站推广慧创科技
  • 大理建设工程信息网站黄石seo
  • 以春天为主题的网站建设资源百度网盘app下载安装 官方下载
  • 宝安区城市建设局网站企业所得税优惠政策
  • 广元网站建设工作室百度快照收录
  • 关于美食html网页设计实例代码西安优化外
  • 购物网站 后台模板登录百度
  • 每日聚划算优惠网站怎么做的优秀软文营销案例