Selaa lähdekoodia

_id is not returned by mongo insert

prieto 8 vuotta sitten
vanhempi
commit
cbe8f7da13
1 muutettua tiedostoa jossa 12 lisäystä ja 2 poistoa
  1. 12
    2
      plugins/mongodb_datasource/datasource.py

+ 12
- 2
plugins/mongodb_datasource/datasource.py Näytä tiedosto

@@ -130,11 +130,20 @@ class MongoDbDatasource(object):
130 130
 
131 131
         query_filters = self.__process_filters(
132 132
             target, filters, relational_filters)
133
+        
133 134
         query_result_ordering = None
134 135
         if order is not None:
135 136
             query_result_ordering = utils.parse_query_order(order)
136 137
         
137 138
         if group is None:
139
+            if field_list is None:
140
+                field_list = dict()
141
+            else:
142
+                f_list=dict()
143
+                for fl in field_list:
144
+                    f_list[fl] = 1
145
+                field_list = f_list
146
+            field_list['_id'] = 0
138 147
             cursor = collection.find(
139 148
                 spec = query_filters,
140 149
                 fields=field_list,
@@ -205,8 +214,9 @@ class MongoDbDatasource(object):
205 214
         #Non abstract beahavior
206 215
         mongo_filters = self.__process_filters(
207 216
             target, filters, relational_filters)
208
-        res = self.__collection(target).update_many(mongo_filters, upd_datas)
209
-        return res.modified_count()
217
+        res = self.__collection(target).update(mongo_filters, upd_datas)
218
+        
219
+        return 1 #res.modified_count()
210 220
 
211 221
     ## @brief Inserts a record in a given collection
212 222
     # @param target Emclass : class of the object to insert

Loading…
Peruuta
Tallenna