aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--umosapi/api.py8
-rw-r--r--umosapi/app_db/uobject.py6
2 files changed, 14 insertions, 0 deletions
diff --git a/umosapi/api.py b/umosapi/api.py
index 8a0945f..45bab9c 100644
--- a/umosapi/api.py
+++ b/umosapi/api.py
@@ -98,3 +98,11 @@ class ObjectsEq(Resource):
"msg": status['msg'],
"datas": sanitize(status['datas'])
}, status['code']
+
+
+@api.route("/objects/reset")
+class ObjectsClean(Resource):
+ def get(self):
+ """ Reset collection """
+ uobject.reset()
+ return "done"
diff --git a/umosapi/app_db/uobject.py b/umosapi/app_db/uobject.py
index 60094c7..00aa9b7 100644
--- a/umosapi/app_db/uobject.py
+++ b/umosapi/app_db/uobject.py
@@ -85,3 +85,9 @@ class UObject(object):
"datas": datas,
"code": 404
}
+
+ def reset(self):
+ db = MongoDB(self.app)
+ mongo = db.connection()
+ mongo.db.uobjects.remove()
+ return "done"