diff --git a/monkey/monkey_island/cc/repository/mongo_credentials_repository.py b/monkey/monkey_island/cc/repository/mongo_credentials_repository.py index 237f052e4..3fdc306a8 100644 --- a/monkey/monkey_island/cc/repository/mongo_credentials_repository.py +++ b/monkey/monkey_island/cc/repository/mongo_credentials_repository.py @@ -55,9 +55,8 @@ class MongoCredentialsRepository(ICredentialsRepository): def _get_credentials_from_collection(self, collection) -> Sequence[Credentials]: try: collection_result = [] - list_collection_result = list(collection.find({})) + list_collection_result = list(collection.find({}, {MONGO_OBJECT_ID_KEY: False})) for encrypted_credentials in list_collection_result: - del encrypted_credentials[MONGO_OBJECT_ID_KEY] plaintext_credentials = self._decrypt_credentials_mapping(encrypted_credentials) collection_result.append(Credentials(**plaintext_credentials))