Browse Source

First implementation of the delete method of the MongoDbDataSource

Roland Haroutiounian 9 years ago
parent
commit
e47dc0d8ee
1 changed files with 8 additions and 5 deletions
  1. 8
    5
      lodel/datasource/mongodb_datasource.py

+ 8
- 5
lodel/datasource/mongodb_datasource.py View File

@@ -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

Loading…
Cancel
Save