# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/database.ipynb (unless otherwise specified).

__all__ = ['Database']

# Cell
from pymongo import MongoClient

# Cell
class Database:
    def __init__(self, host, port, db, collection):
        self.client = MongoClient(f"mongodb://{host}:{port}/")
        self.db = self.client[db]
        self.collection = self.db[collection]

    def find(self):
        return self.collection.find()

    def clear(self):
        return self.collection.delete_many({})

    def insert_many(self, docs):
        return self.collection.insert_many(docs)

    def insert_one(self, doc):
        return self.collection.insert_one(doc)
