浏览代码

First implementation of the delete method of the MongoDbDataSource

Roland Haroutiounian 9 年前
父节点
当前提交
e47dc0d8ee
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8
    5
      lodel/datasource/mongodb_datasource.py

+ 8
- 5
lodel/datasource/mongodb_datasource.py 查看文件

@@ -15,14 +15,17 @@ class MongoDbDataSource(object):
15 15
         self.connection = MongoClient(connection_args['host'], connection_args['port'])
16 16
         self.database = self.connection[connection_args['dbname']]
17 17
 
18
-    def select(self):
18
+    def insert(self):
19 19
         pass
20 20
 
21
-    def delete(self):
21
+    def select(self):
22 22
         pass
23
-
23
+    
24 24
     def update(self):
25 25
         pass
26 26
 
27
-    def insert(self):
28
-        pass
27
+    def delete(self, target_cls, uid):
28
+        uidname = target_cls.uidname
29
+        collection_name = target_cls.collection_name
30
+        result = self.database[collection_name].delete_many({uidname: uid})
31
+        return result.deteled_count

正在加载...
取消
保存