From e243db5087def1dd68e2f6ff07da87be5654a9b4 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Mon, 15 Aug 2016 19:38:42 -0400 Subject: [PATCH] lib/popcorn: add limit and skip to pop_repos Signed-off-by: Alexandre Terrasa --- lib/popcorn/pop_repos.nit | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/popcorn/pop_repos.nit b/lib/popcorn/pop_repos.nit index c950ea4..03cc97b 100644 --- a/lib/popcorn/pop_repos.nit +++ b/lib/popcorn/pop_repos.nit @@ -149,7 +149,7 @@ interface Repository[E: Serializable] # Find all instances based on `query` # # Using `query` == null will retrieve all the document in the repository. - fun find_all(query: nullable QUERY): Array[E] is abstract + fun find_all(query: nullable QUERY, skip, limit: nullable Int): Array[E] is abstract # Save an `instance` fun save(instance: E): Bool is abstract @@ -293,9 +293,9 @@ class MongoRepository[E: Serializable] return deserialize(res.to_json) end - redef fun find_all(query) do + redef fun find_all(query, skip, limit) do var res = new Array[E] - for e in collection.find_all(query or else new JsonObject) do + for e in collection.find_all(query or else new JsonObject, skip, limit) do res.add deserialize(e.to_json).as(E) end return res -- 1.7.9.5