projects
/
osm
/
common.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adding tests for MsgLocal
[osm/common.git]
/
osm_common
/
dbmongo.py
diff --git
a/osm_common/dbmongo.py
b/osm_common/dbmongo.py
index
582773a
..
9e34920
100644
(file)
--- a/
osm_common/dbmongo.py
+++ b/
osm_common/dbmongo.py
@@
-1,7
+1,7
@@
import logging
from pymongo import MongoClient, errors
import logging
from pymongo import MongoClient, errors
-from dbbase import DbException, DbBase
+from
osm_common.
dbbase import DbException, DbBase
from http import HTTPStatus
from time import time, sleep
from http import HTTPStatus
from time import time, sleep
@@
-167,12
+167,12
@@
class DbMongo(DbBase):
try:
collection = self.db[table]
rows = collection.update_one(self._format_filter(filter), {"$set": update_dict})
try:
collection = self.db[table]
rows = collection.update_one(self._format_filter(filter), {"$set": update_dict})
- if rows.
updat
ed_count == 0:
+ if rows.
match
ed_count == 0:
if fail_on_empty:
raise DbException("Not found any {} with filter='{}'".format(table[:-1], filter),
HTTPStatus.NOT_FOUND)
return None
if fail_on_empty:
raise DbException("Not found any {} with filter='{}'".format(table[:-1], filter),
HTTPStatus.NOT_FOUND)
return None
- return {"
deleted": rows.delet
ed_count}
+ return {"
modified": rows.modifi
ed_count}
except Exception as e: # TODO refine
raise DbException(str(e))
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
raise DbException("Not found any {} with filter='{}'".format(table[:-1], _filter),
HTTPStatus.NOT_FOUND)
return None
- return {"replace": rows.modified_count}
+ return {"replace
d
": rows.modified_count}
except Exception as e: # TODO refine
raise DbException(str(e))
except Exception as e: # TODO refine
raise DbException(str(e))