from .app_db_context import AppDbContext

class RepositoryBase(object):

    def __init__(self):
        context = AppDbContext()
        self.db = context.getDbContext()
  
    def insert_one(self, collection, data):
        return self.db[collection].insert_one(data)

    def find(self, collection, query):
        return self.db[collection].find(query)

    def find_one(self, collection, query, *args, **kwargs):
        return self.db[collection].find_one(query, *args, **kwargs)

    def delete_one(self, collection, query):
        self.db[collection].delete_one(query)