java操作mongodb指定集合及索引建立spring boot(组合索引,复合索引)
发布日期:2021-06-20 07:26:24 浏览次数:24 分类:技术文章

本文共 1246 字,大约阅读时间需要 4 分钟。

package com.paic.aims.farmer.farmerinfo.dto;import io.swagger.annotations.ApiModel;import io.swagger.annotations.ApiModelProperty;import org.springframework.data.mongodb.core.index.CompoundIndex;import org.springframework.data.mongodb.core.index.CompoundIndexes;import org.springframework.data.mongodb.core.mapping.Document;import java.io.Serializable;/** * @author  *  2018/3/28. * 三农资讯 */ /*指定集合*/@Document(collection = "AIMS_INFORMATION")@ApiModel(value = "APP端返回三农资讯列表实体类")/*建立索引,提高查询速度 */@CompoundIndexes(        {                @CompoundIndex(name = "publishDate_informationId",def = "{'publishDate':-1,'informationId':1}")        })public class InformationAppListModel implements Serializable{    /**主键ID**/    @ApiModelProperty(value = "id", example = "")    private String informationId;    /**信息标题**/    @ApiModelProperty(value = "信息标题", example = "")    private String informationTitle;    /**摘要**/    @ApiModelProperty(value = "摘要", example = "")    private String publishAbstract;    /**封面图片id**/    @ApiModelProperty(value = "封面图片id", example = "")    private Date publishDate;    // }————————————————版权声明:本文为CSDN博主「杨杨1234」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/yjw1007020425/article/details/80222556

 

转载地址:https://blog.csdn.net/HD243608836/article/details/101383338 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:spring mongodb Criteria中"and"与"andOperator"方法的区别及"$and"如何工作(附:复合索引)
下一篇:springAOP切入点表达式怎么排除某些方法

发表评论

最新留言

路过,博主的博客真漂亮。。
[***.116.15.85]2024年03月31日 08时27分24秒