def get_documents_in_collection(self, collection_name, with_id=True):
        """Gets all documents in collection

        :param collection_name: Name of collection
        :param with_id: True iff each document should also come with its id
        :return: List of documents in collection in self.db
        """
        documents_iterator = self.database[collection_name].find()  # anything
        documents = [
            d for d in documents_iterator
        ]  # list of all documents in collection in database

        if not with_id:
            for doc in documents:
                doc.pop("_id")  # remove id key

        return documents
def get_documents_in_collection ( self , collection_name , with_id = True ) : documents_iterator = self . database [ collection_name ] . find ( ) documents = [ d for d in documents_iterator ] if not with_id : for doc in documents : doc . pop ( "_id" ) return documents
Gets all documents in collection

        :param collection_name: Name of collection
        :param with_id: True iff each document should also come with its id
        :return: List of documents in collection in self.db