X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=lcm%2Fosm_common%2Fdbmongo.py;h=46e4dc84040c4bf74f63cb7758ceabf4cd21bc44;hb=40d97800f7b48f533abfcdef98ee992daf9acb37;hp=6bc35a5860488c33436961a33810b815b22c82db;hpb=f3a5443bfaf65f22540eff98a49be087f0479424;p=osm%2FRO.git diff --git a/lcm/osm_common/dbmongo.py b/lcm/osm_common/dbmongo.py index 6bc35a58..46e4dc84 100644 --- a/lcm/osm_common/dbmongo.py +++ b/lcm/osm_common/dbmongo.py @@ -167,12 +167,12 @@ class DbMongo(DbBase): try: collection = self.db[table] rows = collection.update_one(self._format_filter(filter), {"$set": update_dict}) - if rows.updated_count == 0: + if rows.matched_count == 0: if fail_on_empty: raise DbException("Not found any {} with filter='{}'".format(table[:-1], filter), HTTPStatus.NOT_FOUND) return None - return {"deleted": rows.deleted_count} + return {"modified": rows.modified_count} except Exception as e: # TODO refine raise DbException(str(e)) @@ -186,6 +186,6 @@ class DbMongo(DbBase): raise DbException("Not found any {} with filter='{}'".format(table[:-1], _filter), HTTPStatus.NOT_FOUND) return None - return {"replace": rows.modified_count} + return {"replaced": rows.modified_count} except Exception as e: # TODO refine raise DbException(str(e))