Skip to content

Commit 6e4b54e

Browse files
committed
PYTHON-1109 - Custom type examples are deprecated
1 parent 7a64cfc commit 6e4b54e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

doc/examples/custom_type.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
Custom Type Example
22
===================
33

4+
.. warning:: The following examples document a deprecated feature. The
5+
:class:`~pymongo.son_manipulator.SONManipulator` API has limitations as a
6+
technique for transforming your data. Instead, it is more flexible and
7+
straightforward to transform outgoing documents in your own code before
8+
passing them to PyMongo, and transform incoming documents after receiving
9+
them from PyMongo.
10+
11+
Thus the :meth:`~pymongo.database.Database.add_son_manipulator` method is
12+
deprecated. PyMongo 3's new CRUD API does **not** apply SON manipulators to
13+
documents passed to :meth:`~pymongo.collection.Collection.bulk_write`,
14+
:meth:`~pymongo.collection.Collection.insert_one`,
15+
:meth:`~pymongo.collection.Collection.insert_many`,
16+
:meth:`~pymongo.collection.Collection.update_one`, or
17+
:meth:`~pymongo.collection.Collection.update_many`. SON manipulators are
18+
**not** applied to documents returned by the new methods
19+
:meth:`~pymongo.collection.Collection.find_one_and_delete`,
20+
:meth:`~pymongo.collection.Collection.find_one_and_replace`, and
21+
:meth:`~pymongo.collection.Collection.find_one_and_update`.
22+
23+
424
This is an example of using a custom type with PyMongo. The example
525
here is a bit contrived, but shows how to use a
626
:class:`~pymongo.son_manipulator.SONManipulator` to manipulate

0 commit comments

Comments
 (0)