From 93bb0948fe76d608aab054a58d9c6bb71a5668ee Mon Sep 17 00:00:00 2001 From: Raul Mello Silva Date: Fri, 18 Mar 2022 10:28:35 -0300 Subject: [PATCH] Add limit 0 behavior description The number of items returned by the method `Query limit(int limit)` is equal to the value passed as a parameter. However, if the value is 0 the method returns all documents ignoring the "limit", this behavior may be misleading and I think it should be detailed in the documentation. --- .../java/org/springframework/data/mongodb/core/query/Query.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java index 6e54130a14..7749573975 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java @@ -136,6 +136,7 @@ public Query skip(long skip) { /** * Limit the number of returned documents to {@code limit}. + * If limit chosen is 0 it returns all documents * * @param limit * @return this.