Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-5129

Async transaction documentation does not align with actual behavior

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.12
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Python Drivers
    • Completed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Detailed steps to reproduce the problem?

      The async transactions documentation, specifically lines 56 an 57 in client_sesssion.py, do not appear to be correct.

      If I do not place an "async" on line 56, I get the error: `
      AsyncClientSession' object does not support the context manager protocol
       
      If I do not place an "await" on line 57, I get the error:
      'AsyncClientSession' object does not support the context manager protocol
       
      I've attached a short script as an example.

      Definition of done: what must be done to consider the task complete?

      Documentation is updated. Or, please let me know if I'm doing something dumb here.

      The exact Python version used, with patch level:

      $ python -c "import sys; print(sys.version)"

      3.13.1 (main, Dec 19 2024, 14:22:59) [Clang 18.1.8 ]

      The exact version of PyMongo used, with patch level:

      $ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"

      4.10.1
      True

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      Using MongoDB Atlas

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      MacOs: 15.3 (24D60)

      Web framework or asynchronous network library used, if any, with version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)

      only using asyncio

      Security Vulnerabilities

      If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here

            Assignee:
            noah.stapp@mongodb.com Noah Stapp
            Reporter:
            mike@luminos.ai Mike Schiller
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: