java - 为 findAllByTypeAndCreatedAtAfter() mongodb 方法添加最大大小限制和方向
问题描述
是否可以制定一个像下面这样返回 List 的查询方法1)of max size n
,
包含的 Appliance 对象是2) createdAfter a specific time (Instant) at DESC order
,
和3) they are of a specific TypeEnum
。我已经确定了1st
和2nd
要求,但是
我还没有找到如何添加max size
和direction
限制。
<T extends Appliance> List<T> findAllByTypeAndCreatedAtAfter(ApplianceTypeEnum applianceTypeEnum);
解决方案
你可以这样做:
<T extends Appliance> List<T> findFirst3ByTypeAndCreatedAtAfterDesc(ApplianceTypeEnum applianceTypeEnum);
您可以在此处阅读有关 Spring 派生查询的更多信息
推荐阅读
- c# - 如何使用 .NET Core 2.1 和 Stream API 在 Cosmos DB 中批量插入
- slurm - Snakemake 在使用 --profile slurm 时给出 InputFunctionException
- php - 使用 Laravel 产品 Youtube 克隆时,本地主机上的 HTTP 错误 500
- python - 如何使用 jupyter notebook 或 SQL 取消透视多个列?
- react-native - 与 mongodb 领域反应本机。尝试 google 登录会导致错误代码 10
- docker - Jib:根据 Maven 配置文件设置存储库
- java - Eclipse 外部库
- jersey - 如何从 JDK 14 上的 Javadocs 生成 swagger 规范?
- reactjs - NextJS/Ant-design 样式和 JS 包延迟加载
- reactjs - 反应路由器不加载任何页面