import pymongo
import network_constants as netconst
from database.MongoRepositoryBase import MongoRepositoryBase

class MongoRepository(MongoRepositoryBase):

    def __init__(self):
        super().__init__(netconst.TRACE_RETRIEVAL_DB_HOSTNAME, 
            netconst.TRACE_RETRIEVAL_DB_PORT, 'traceRetrievalDB')
        self._collection_name = 'traces'

    def insert_trace(self, content: dict):
        super().insert_entry(self._collection_name, content)

    def get_traces(self, selection: dict = {}, projection: dict = {'_': 0}) -> pymongo.cursor.Cursor:
        return super().get_entries(self._collection_name, selection, projection)

