예제 #1
0
 def __setitem__(self, column, value):
     # True for any scalar type, numeric, bool, string
     if np.isscalar(value):
         result = self.collection.update_many(filter=self.filter_criteria,
                                              update=qops.SET(column, value))
         self.columns.append(column)
     return self
예제 #2
0
 def test_filter_subdoc(self):
     coll = self.coll
     coll.update_many(qops.IS(x=qops.LT(5)), qops.SET('subdoc.a', 99))
     coll.update_many(qops.IS(x=qops.GTE(5)), qops.SET('subdoc.a', 0))
     result = Filter(coll, subdoc__a__lt=10).value
     self.assertEqual(set(result.x.unique()), set(range(5, 10)))