From 89954223e8c0260082ad8e7f378dd8c3d969aefc Mon Sep 17 00:00:00 2001 From: Kekoa Kaaikala Date: Wed, 14 Sep 2022 17:29:22 +0000 Subject: [PATCH] Island: Match type based on __name__ --- monkey/monkey_island/cc/repository/mongo_event_repository.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/repository/mongo_event_repository.py b/monkey/monkey_island/cc/repository/mongo_event_repository.py index 772c0a3fb..2a2d1451e 100644 --- a/monkey/monkey_island/cc/repository/mongo_event_repository.py +++ b/monkey/monkey_island/cc/repository/mongo_event_repository.py @@ -35,7 +35,9 @@ class MongoEventRepository(IEventRepository): self, event_type: Type[AbstractAgentEvent] ) -> Sequence[AbstractAgentEvent]: try: - serialized_events = list(self._events_collection.find({EVENT_TYPE_FIELD: event_type})) + serialized_events = list( + self._events_collection.find({EVENT_TYPE_FIELD: event_type.__name__}) + ) return list(map(self._deserialize, serialized_events)) except Exception as err: raise RetrievalError(f"Error retrieving events for type {event_type}: {err}")