diff --git a/pymongo/collection.py b/pymongo/collection.py index 46ded9de8..b8b19802c 100644 --- a/pymongo/collection.py +++ b/pymongo/collection.py @@ -1623,7 +1623,7 @@ class Collection(common.BaseObject): def find_and_modify(self, query={}, update=None, upsert=False, sort=None, full_response=False, - manipulate=True, **kwargs): + manipulate=False, **kwargs): """Update and return an object. This is a thin wrapper around the findAndModify_ command. The @@ -1655,9 +1655,9 @@ class Collection(common.BaseObject): - `new`: return updated rather than original object (default ``False``) - `fields`: see second argument to :meth:`find` (default all) - - `manipulate`: (optional): If True (the default), apply any - outgoing SON manipulators before returning. Do not works when - `full_response` is set to True. + - `manipulate`: (optional): If ``True``, apply any outgoing SON + manipulators before returning. Ignored when `full_response` + is set to True. Defaults to ``False``. - `**kwargs`: any other options the findAndModify_ command supports can be passed here. diff --git a/test/test_collection.py b/test/test_collection.py index 248d0ae2c..3070509ab 100644 --- a/test/test_collection.py +++ b/test/test_collection.py @@ -2375,17 +2375,17 @@ class TestCollection(unittest.TestCase): # Test correct findAndModify # With manipulators self.assertEqual({'_id': 1, 'i': 1, 'collection': 'test'}, - c.find_and_modify({'_id': 1}, {'$inc': {'i': 1}})) + c.find_and_modify({'_id': 1}, {'$inc': {'i': 1}}, + manipulate=True)) self.assertEqual({'_id': 1, 'i': 3, 'collection': 'test'}, c.find_and_modify({'_id': 1}, {'$inc': {'i': 1}}, - new=True)) + new=True, manipulate=True)) # With out manipulators self.assertEqual({'_id': 1, 'i': 3}, - c.find_and_modify({'_id': 1}, {'$inc': {'i': 1}}, - manipulate=False)) + c.find_and_modify({'_id': 1}, {'$inc': {'i': 1}})) self.assertEqual({'_id': 1, 'i': 5}, c.find_and_modify({'_id': 1}, {'$inc': {'i': 1}}, - new=True, manipulate=False)) + new=True)) if __name__ == "__main__":