File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,17 @@ class Doc(Document):
5151 update = transform .update (DicDoc , pull__dictField__test = doc )
5252 self .assertTrue (isinstance (update ["$pull" ]["dictField" ]["test" ], dict ))
5353
54+ def test_transform_update_push (self ):
55+ """Ensure the differences in behvaior between 'push' and 'push_all'"""
56+ class BlogPost (Document ):
57+ tags = ListField (StringField ())
58+
59+ update = transform .update (BlogPost , push__tags = ['mongo' , 'db' ])
60+ self .assertEqual (update , {'$push' : {'tags' : ['mongo' , 'db' ]}})
61+
62+ update = transform .update (BlogPost , push_all__tags = ['mongo' , 'db' ])
63+ self .assertEqual (update , {'$push' : {'tags' : {'$each' : ['mongo' , 'db' ]}}})
64+
5465 def test_query_field_name (self ):
5566 """Ensure that the correct field name is used when querying.
5667 """
You can’t perform that action at this time.
0 commit comments