Browse Source

Bugfixe in MongoDb datasource

Pymongo do not handles sets as value. We have to cast them into lists
done only in update for the moment...
Yann Weber 8 years ago
parent
commit
df45f318d4
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      plugins/mongodb_datasource/datasource.py

+ 6
- 0
plugins/mongodb_datasource/datasource.py View File

@@ -222,6 +222,12 @@ abstract, preparing reccursiv calls" % (target, filters, relational_filters))
222 222
     #@param upd_datas dict : datas to update (new values)
223 223
     #@return int : Number of updated records
224 224
     def update(self, target, filters, relational_filters, upd_datas):
225
+        for dname in upd_datas:
226
+            if isinstance(upd_datas[dname], set):
227
+                #pymongo raises :
228
+                #bson.errors.InvalidDocument: Cannot encode object: {...}
229
+                #with sets
230
+                upd_datas[dname] = list(upd_datas[dname])
225 231
         res = self.__update_no_backref(target, filters, relational_filters,
226 232
             upd_datas)
227 233
         self.__update_backref_filtered(target, filters, relational_filters,

Loading…
Cancel
Save