From 9d5a6d5141a186958c5fa254416107e482447d46 Mon Sep 17 00:00:00 2001 From: Nelly Barret <nelly.barret@etu.univ-lyon1.fr> Date: Thu, 14 May 2020 09:35:05 +0200 Subject: [PATCH] Update api.py --- mongiris/api.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mongiris/api.py b/mongiris/api.py index 6eb822b..a622e0d 100755 --- a/mongiris/api.py +++ b/mongiris/api.py @@ -131,6 +131,20 @@ class Mongiris: doc = collection.find_one(json_query) doc_json = Mongiris.bson_to_json(doc) return doc_json + + def find_all(self, collection): + """ + Finds all documents in the given collection. + + Args: + collection: a string representing the collection name + + Returns: + doc_json: a dictionnary representing the documents, or None + """ + doc = collection.find() + doc_json = Mongiris.bson_to_json(doc) + return doc_json def get_iris_from_code(self, code_iris): """ -- GitLab