PYTHON-3445 Improve documentation for custom readPreference tags (#1068)

This commit is contained in:
Julius Park 2022-10-07 12:05:20 -07:00 committed by GitHub
parent 774154e934
commit eaf0e6d84f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -25,7 +25,7 @@ For issues with, questions about, or feedback for PyMongo, please look into
our `support channels <https://support.mongodb.com/welcome>`_. Please
do not email any of the PyMongo developers directly with issues or
questions - you're more likely to get an answer on the `MongoDB Community
Forums <https://developer.mongodb.com/community/forums/tag/python-driver>`_.
Forums <https://www.mongodb.com/community/forums/tag/python>`_.
Bugs / Feature Requests
=======================

View File

@ -84,7 +84,7 @@ Doing a Release
13. Publish the release version in Jira.
14. Announce the release on:
https://developer.mongodb.com/community/forums/c/community/release-notes/
https://www.mongodb.com/community/forums/c/announcements/driver-releases/110
15. File a ticket for DOCSP highlighting changes in server version and Python
version compatibility or the lack thereof, for example:

View File

@ -151,6 +151,13 @@ class _ServerMode(object):
set, ``{}``, means "read from any member that matches the mode,
ignoring tags." MongoClient tries each set of tags in turn
until it finds a set of tags with at least one matching member.
For example, to only send a query to an analytic node::
Nearest(tag_sets=[{"node":"analytics"}])
Or using :class:`SecondaryPreferred`::
SecondaryPreferred(tag_sets=[{"node":"analytics"}])
.. seealso:: `Data-Center Awareness
<https://www.mongodb.com/docs/manual/data-center-awareness/>`_
@ -518,7 +525,11 @@ _MODES = (
class ReadPreference(object):
"""An enum that defines the read preference modes supported by PyMongo.
"""An enum that defines some commonly used read preference modes.
Apps can also create a custom read preference, for example::
Nearest(tag_sets=[{"node":"analytics"}])
See :doc:`/examples/high_availability` for code examples.