Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,21 @@ jobs:
run: |
mypy --install-types --non-interactive bson gridfs tools pymongo
mypy --install-types --non-interactive --disable-error-code var-annotated --disable-error-code attr-defined --disable-error-code union-attr --disable-error-code assignment --disable-error-code no-redef --disable-error-code index --allow-redefinition --allow-untyped-globals --exclude "test/mypy_fails/*.*" test

linkcheck:
name: Check Links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install sphinx
- name: Check links
run: |
cd doc
make linkcheck
2 changes: 1 addition & 1 deletion bson/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class Binary(bytes):
- `data`: the binary data to represent. Can be any bytes-like type
that implements the buffer protocol.
- `subtype` (optional): the `binary subtype
<http://bsonspec.org/#/specification>`_
<https://bsonspec.org/spec.html>`_
to use

.. versionchanged:: 3.9
Expand Down
2 changes: 1 addition & 1 deletion doc/atlas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Connections to Atlas require TLS/SSL.

You can read more about TLS versions and their security implications here:

`<https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet#Rule_-_Only_Support_Strong_Protocols>`_
`<https://cheatsheetseries.owasp.org/cheatsheets/Transport_Layer_Protection_Cheat_Sheet.html#only-support-strong-protocols>`_

.. _python.org: https://www.python.org/downloads/
.. _homebrew: https://brew.sh/
Expand Down
2 changes: 1 addition & 1 deletion doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ Changes and Deprecations:
- Deprecated the MongoClient option `socketKeepAlive`. It now defaults to true
and disabling it is not recommended, see `does TCP keepalive time affect
MongoDB Deployments?
<https://docs.mongodb.com/manual/faq/diagnostics/#does-tcp-keepalive-time-affect-mongodb-deployments>`_
<https://docs.mongodb.com/manual/faq/diagnostics/#does-tcp-keepalive-time-affect-mongodb-deployments->`_
- Deprecated :meth:`~pymongo.collection.Collection.initialize_ordered_bulk_op`,
:meth:`~pymongo.collection.Collection.initialize_unordered_bulk_op`, and
:class:`~pymongo.bulk.BulkOperationBuilder`. Use
Expand Down
7 changes: 7 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []

# Options for link checking
# The anchors on the rendered markdown page are created after the fact,
# so this link results in a 404.
linkcheck_ignore = [
"https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-monitoring.rst#requesting-an-immediate-check"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ignore this link? It works fine for me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get an error saying that the anchor is unavailable. I think the anchors get lazily created after it gets rendered.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh thanks. Could you add a comment explaining that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

]

# -- Options for extensions ----------------------------------------------------
autoclass_content = "init"

Expand Down
2 changes: 1 addition & 1 deletion doc/developer/periodic_executor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Thus the current design of periodic executors is surprisingly simple: they
do a simple `time.sleep` for a half-second, check if it is time to wake or
terminate, and sleep again.

.. _Server Discovery And Monitoring Spec: https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#requesting-an-immediate-check
.. _Server Discovery And Monitoring Spec: https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-monitoring.rst#requesting-an-immediate-check

.. _PYTHON-863: https://jira.mongodb.org/browse/PYTHON-863

Expand Down
2 changes: 1 addition & 1 deletion doc/examples/high_availability.rst
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ milliseconds of the closest member's ping time.
replica set *through* a mongos. The equivalent is the localThreshold_ command
line option.

.. _localThreshold: http://docs.mongodb.org/manual/reference/mongos/#cmdoption--localThreshold
.. _localThreshold: https://docs.mongodb.com/manual/reference/program/mongos/#std-option-mongos.--localThreshold

.. _health-monitoring:

Expand Down
6 changes: 3 additions & 3 deletions doc/examples/mod_wsgi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
PyMongo and mod_wsgi
====================

To run your application under `mod_wsgi <http://code.google.com/p/modwsgi/>`_,
To run your application under `mod_wsgi <https://github.com/GrahamDumpleton/mod_wsgi/>`_,
follow these guidelines:

* Run ``mod_wsgi`` in daemon mode with the ``WSGIDaemonProcess`` directive.
Expand Down Expand Up @@ -48,9 +48,9 @@ interpreter.

Python C extensions in general have issues running in multiple
Python sub interpreters. These difficulties are explained in the documentation for
`Py_NewInterpreter <http://docs.python.org/2/c-api/init.html#Py_NewInterpreter>`_
`Py_NewInterpreter <https://docs.python.org/3/c-api/init.html#c.Py_NewInterpreter>`_
and in the `Multiple Python Sub Interpreters
<https://code.google.com/p/modwsgi/wiki/ApplicationIssues#Multiple_Python_Sub_Interpreters>`_
<https://modwsgi.readthedocs.io/en/master/user-guides/application-issues.html#multiple-python-sub-interpreters>`_
section of the ``mod_wsgi`` documentation.

Beginning with PyMongo 2.7, the C extension for BSON detects when it is running
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/tailable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ By default, MongoDB will automatically close a cursor when the client has
exhausted all results in the cursor. However, for `capped collections
<https://docs.mongodb.org/manual/core/capped-collections/>`_ you may
use a `tailable cursor
<https://docs.mongodb.org/manual/reference/glossary/#term-tailable-cursor>`_
<https://docs.mongodb.com/manual/core/tailable-cursors/>`_
that remains open after the client exhausts the results in the initial cursor.

The following is a basic example of using a tailable cursor to tail the oplog
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/tls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ MongoDB.

You can read more about TLS versions and their security implications here:

`<https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet#Rule_-_Only_Support_Strong_Protocols>`_
`<https://cheatsheetseries.owasp.org/cheatsheets/Transport_Layer_Protection_Cheat_Sheet.html#only-support-strong-protocols>`_

.. _python.org: https://www.python.org/downloads/
.. _homebrew: https://brew.sh/
Expand Down
2 changes: 1 addition & 1 deletion doc/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ when it is serialized to BSON and used as a query. Thus you can create a
subdocument that exactly matches the subdocument in the collection.

.. seealso:: `MongoDB Manual entry on subdocument matching
<http://docs.mongodb.org/manual/tutorial/query-documents/#embedded-documents>`_.
<https://docs.mongodb.com/manual/tutorial/query-embedded-documents/>`_.

What does *CursorNotFound* cursor id not valid at server mean?
--------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ everything you need to know to use **PyMongo**.
Getting Help
------------
If you're having trouble or have questions about PyMongo, ask your question on
our `MongoDB Community Forum <https://developer.mongodb.com/community/forums/tags/c/drivers-odms-connectors/7/python-driver>`_.
our `MongoDB Community Forum <https://www.mongodb.com/community/forums/tag/python>`_.
You may also want to consider a
`commercial support subscription <https://support.mongodb.com/welcome>`_.
Once you get an answer, it'd be great if you could work it back into this
Expand Down
7 changes: 3 additions & 4 deletions doc/migrate-to-pymongo4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ The socketKeepAlive parameter is removed

Removed the ``socketKeepAlive`` keyword argument to
:class:`~pymongo.mongo_client.MongoClient`. PyMongo now always enables TCP
keepalive. For more information see:
https://docs.mongodb.com/manual/faq/diagnostics/#does-tcp-keepalive-time-affect-mongodb-deployments
keepalive. For more information see the `documentation <https://docs.mongodb.com/manual/faq/diagnostics/#does-tcp-keepalive-time-affect-mongodb-deployments->`_.

Renamed URI options
...................
Expand Down Expand Up @@ -545,8 +544,8 @@ Can be changed to this::

.. _$expr: https://docs.mongodb.com/manual/reference/operator/query/expr/
.. _$geoWithin: https://docs.mongodb.com/manual/reference/operator/query/geoWithin/
.. _$center: https://docs.mongodb.com/manual/reference/operator/query/center/#op._S_center
.. _$centerSphere: https://docs.mongodb.com/manual/reference/operator/query/centerSphere/#op._S_centerSphere
.. _$center: https://docs.mongodb.com/manual/reference/operator/query/center/
.. _$centerSphere: https://docs.mongodb.com/manual/reference/operator/query/centerSphere/

Collection.initialize_ordered_bulk_op and initialize_unordered_bulk_op is removed
.................................................................................
Expand Down
20 changes: 6 additions & 14 deletions doc/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ PyMODM
libraries to target platforms like Django. At the same time, PyMODM is
powerful enough to be used for developing applications on its own. Complete
documentation is available on `readthedocs
<https://pymodm.readthedocs.io/en/stable/>`_ in addition to a `Gitter channel
<https://gitter.im/mongodb/pymodm>`_ for discussing the project.
<https://pymodm.readthedocs.io/en/stable/>`_.

Humongolus
`Humongolus <https://github.com/entone/Humongolus>`_ is a lightweight ORM
Expand Down Expand Up @@ -72,7 +71,7 @@ MongoEngine
documents and query collections using syntax inspired by the Django
ORM. The code is available on `GitHub
<http://github.com/mongoengine/mongoengine>`_; for more information, see
the `tutorial <http://docs.mongoengine.org/en/latest/tutorial.html>`_.
the `tutorial <https://docs.mongoengine.org/tutorial.html>`_.

MotorEngine
`MotorEngine <https://motorengine.readthedocs.io/>`_ is a port of
Expand Down Expand Up @@ -122,10 +121,10 @@ Framework Tools
This section lists tools and adapters that have been designed to work with
various Python frameworks and libraries.

* `Djongo <https://nesdis.github.io/djongo/>`_ is a connector for using
* `Djongo <https://www.djongomapper.com/>`_ is a connector for using
Django with MongoDB as the database backend. Use the Django Admin GUI to add and
modify documents in MongoDB.
The `Djongo Source Code <https://github.com/nesdis/djongo>`_ is hosted on GitHub
The `Djongo Source Code <https://github.com/doableware/djongo>`_ is hosted on GitHub
and the `Djongo package <https://pypi.python.org/pypi/djongo>`_ is on pypi.
* `Django MongoDB Engine
<https://django-mongodb-engine.readthedocs.io/en/latest/>`_ is a MongoDB
Expand All @@ -138,24 +137,17 @@ various Python frameworks and libraries.
<https://github.com/MongoEngine/django-mongoengine>`_ is a MongoDB backend for
Django, an `example:
<https://github.com/MongoEngine/django-mongoengine/tree/master/example/tumblelog>`_.
For more information `<http://docs.mongoengine.org/en/latest/django.html>`_
For more information see `<https://django-mongoengine.readthedocs.io/en/latest/>`_
* `mongodb_beaker <http://pypi.python.org/pypi/mongodb_beaker>`_ is a
project to enable using MongoDB as a backend for `beaker's
<http://beaker.groovie.org/>`_ caching / session system.
project to enable using MongoDB as a backend for `beakers <https://beaker.readthedocs.io/en/latest/>`_ caching / session system.
`The source is on GitHub <http://github.com/bwmcadams/mongodb_beaker>`_.
* `Log4Mongo <https://github.com/log4mongo/log4mongo-python>`_ is a flexible
Python logging handler that can store logs in MongoDB using normal and capped
collections.
* `MongoLog <http://github.com/puentesarrin/mongodb-log/>`_ is a Python logging
handler that stores logs in MongoDB using a capped collection.
* `c5t <http://bitbucket.org/percious/c5t/>`_ is a content-management system
using TurboGears and MongoDB.
* `rod.recipe.mongodb <http://pypi.python.org/pypi/rod.recipe.mongodb/>`_ is a
ZC Buildout recipe for downloading and installing MongoDB.
* `repoze-what-plugins-mongodb
<http://code.google.com/p/repoze-what-plugins-mongodb/>`_ is a project
working to support a plugin for using MongoDB as a backend for
:mod:`repoze.what`.
* `mongobox <http://github.com/theorm/mongobox>`_ is a tool to run a sandboxed
MongoDB instance from within a python app.
* `Flask-MongoAlchemy <http://github.com/cobrateam/flask-mongoalchemy/>`_ Add
Expand Down
2 changes: 1 addition & 1 deletion pymongo/change_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ChangeStream(Generic[_DocumentType]):
:meth:`pymongo.mongo_client.MongoClient.watch` instead.

.. versionadded:: 3.6
.. seealso:: The MongoDB documentation on `changeStreams <https://dochub.mongodb.org/core/changeStreams>`_.
.. seealso:: The MongoDB documentation on `changeStreams <https://docs.mongodb.com/manual/changeStreams/>`_.
"""

def __init__(
Expand Down
8 changes: 4 additions & 4 deletions pymongo/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1784,8 +1784,8 @@ def count_documents(

.. _$expr: https://docs.mongodb.com/manual/reference/operator/query/expr/
.. _$geoWithin: https://docs.mongodb.com/manual/reference/operator/query/geoWithin/
.. _$center: https://docs.mongodb.com/manual/reference/operator/query/center/#op._S_center
.. _$centerSphere: https://docs.mongodb.com/manual/reference/operator/query/centerSphere/#op._S_centerSphere
.. _$center: https://docs.mongodb.com/manual/reference/operator/query/center/
.. _$centerSphere: https://docs.mongodb.com/manual/reference/operator/query/centerSphere/
"""
pipeline = [{"$match": filter}]
if "skip" in kwargs:
Expand Down Expand Up @@ -2011,7 +2011,7 @@ def create_index(

.. seealso:: The MongoDB documentation on `indexes <https://dochub.mongodb.org/core/indexes>`_.

.. _wildcard index: https://docs.mongodb.com/master/core/index-wildcard/#wildcard-index-core
.. _wildcard index: https://docs.mongodb.com/master/core/index-wildcard/
"""
cmd_options = {}
if "maxTimeMS" in kwargs:
Expand Down Expand Up @@ -2557,7 +2557,7 @@ def watch(

.. versionadded:: 3.6

.. seealso:: The MongoDB documentation on `changeStreams <https://dochub.mongodb.org/core/changeStreams>`_.
.. seealso:: The MongoDB documentation on `changeStreams <https://docs.mongodb.com/manual/changeStreams/>`_.

.. _change streams specification:
https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst
Expand Down
2 changes: 1 addition & 1 deletion pymongo/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def watch(

.. versionadded:: 3.7

.. seealso:: The MongoDB documentation on `changeStreams <https://dochub.mongodb.org/core/changeStreams>`_.
.. seealso:: The MongoDB documentation on `changeStreams <https://docs.mongodb.com/manual/changeStreams/>`_.

.. _change streams specification:
https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst
Expand Down
2 changes: 1 addition & 1 deletion pymongo/mongo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ def watch(

.. versionadded:: 3.7

.. seealso:: The MongoDB documentation on `changeStreams <https://dochub.mongodb.org/core/changeStreams>`_.
.. seealso:: The MongoDB documentation on `changeStreams <https://docs.mongodb.com/manual/changeStreams/>`_.

.. _change streams specification:
https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst
Expand Down
2 changes: 1 addition & 1 deletion pymongo/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def __init__(self, keys: _IndexKeyHint, **kwargs: Any) -> None:
Added the ``partialFilterExpression`` option to support partial
indexes.

.. _wildcard index: https://docs.mongodb.com/master/core/index-wildcard/#wildcard-index-core
.. _wildcard index: https://docs.mongodb.com/master/core/index-wildcard/
"""
keys = _index_list(keys)
if "name" not in kwargs:
Expand Down