Explorar o código

Find_and_modify is more suited for edits

oz123 %!s(int64=10) %!d(string=hai) anos
pai
achega
5d1f4571ab
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      pwman/data/drivers/mongodb.py

+ 1 - 1
pwman/data/drivers/mongodb.py

@@ -86,7 +86,7 @@ class MongoDB(Database):
         return tags
         return tags
 
 
     def editnode(self, nid, **kwargs):
     def editnode(self, nid, **kwargs):
-        self._db.nodes.update({'_id': nid}, { '$set' : kwargs})
+        self._db.nodes.find_and_modify({'_id': nid}, kwargs)
 
 
     def removenodes(self, nid):
     def removenodes(self, nid):
         nid = list(map(int, nid))
         nid = list(map(int, nid))