diff --git a/CveXplore/.schema_version b/CveXplore/.schema_version index d38695d7..0f1efb3a 100644 --- a/CveXplore/.schema_version +++ b/CveXplore/.schema_version @@ -1,4 +1,4 @@ { - "version": "1.8", + "version": "1.9", "rebuild_needed": true } diff --git a/CveXplore/core/database_actions/db_action.py b/CveXplore/core/database_actions/db_action.py index 19101da8..e8984cdc 100644 --- a/CveXplore/core/database_actions/db_action.py +++ b/CveXplore/core/database_actions/db_action.py @@ -13,7 +13,7 @@ class DatabaseAction(object): actions = collections.namedtuple("Actions", "InsertOne UpdateOne")(0, 1) - def __init__(self, action: actions, doc: dict): + def __init__(self, action: actions, doc: dict, upsert: bool = True): """ Create a DatabaseAction object. @@ -23,6 +23,7 @@ def __init__(self, action: actions, doc: dict): """ self.action = action self.doc = doc + self.upsert = upsert @property def entry(self): @@ -37,4 +38,6 @@ def entry(self): if self.action == self.actions.InsertOne: return InsertOne(self.doc) elif self.action == self.actions.UpdateOne: - return UpdateOne({"id": self.doc["id"]}, {"$set": self.doc}, upsert=True) + return UpdateOne( + {"id": self.doc["id"]}, {"$set": self.doc}, upsert=self.upsert + ) diff --git a/CveXplore/core/database_maintenance/sources_process.py b/CveXplore/core/database_maintenance/sources_process.py index ed5468fb..f1d0eca5 100644 --- a/CveXplore/core/database_maintenance/sources_process.py +++ b/CveXplore/core/database_maintenance/sources_process.py @@ -1048,8 +1048,7 @@ def process_item(self, item): if epss is not None: self.queue.put( DatabaseAction( - action=DatabaseAction.actions.UpdateOne, - doc=epss, + action=DatabaseAction.actions.UpdateOne, doc=epss, upsert=False ) ) diff --git a/requirements/modules/mongodb.txt b/requirements/modules/mongodb.txt index 4e9d13d2..7930f795 100644 --- a/requirements/modules/mongodb.txt +++ b/requirements/modules/mongodb.txt @@ -1 +1 @@ -pymongo>=4.5.0 \ No newline at end of file +pymongo>=4.8.0 \ No newline at end of file