diff --git a/fedn/network/storage/statestore/mongostatestore.py b/fedn/network/storage/statestore/mongostatestore.py index 7262e5554..ffae773d0 100644 --- a/fedn/network/storage/statestore/mongostatestore.py +++ b/fedn/network/storage/statestore/mongostatestore.py @@ -738,7 +738,11 @@ def set_client(self, client_data): :return: """ client_data["updated_at"] = str(datetime.now()) - self.clients.update_one({"client_id": client_data["client_id"]}, {"$set": client_data}, True) + try: + self.clients.update_one({"client_id": client_data["client_id"]}, {"$set": client_data}, True) + except KeyError: + # If client_id is not present, use name as identifier, for backwards compatibility + self.clients.update_one({"name": client_data["name"]}, {"$set": client_data}, True) def get_client(self, client_id): """Get client by client_id.