Skip to content

PYTHON-2536 Document Versioned API Usage #584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

prashantmital
Copy link
Contributor

No description provided.


>>> client = MongoClient(server_api=ServerApi('1', strict=True))
>>> server_api=ServerApi('1', strict=True)
Copy link
Member

Choose a reason for hiding this comment

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

server_api=ServerApi -> server_api = ServerApi

>>> server_api=ServerApi('1', deprecation_errors=True)
>>> client = MongoClient(server_api=server_api)

Note that at the time of this writing, no deprecated APIs exist.
Copy link
Member

Choose a reason for hiding this comment

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

Do we have an example of what a deprecation would look like? Would it be an OperationFailure error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

>>> client.db.command(command={'testDeprecationInVersion2': 1, 'apiVersion': '2', 'apiDeprecationErrors': True})
...
pymongo.errors.OperationFailure: Provided apiDeprecationErrors:true, but the command testDeprecationInVersion2 is deprecated in API Version 2, full error: {'ok': 0.0, 'errmsg': 'Provided apiDeprecationErrors:true, but the command testDeprecationInVersion2 is deprecated in API Version 2', 'code': 324, 'codeName': 'APIDeprecationError', '$clusterTime': {'clusterTime': Timestamp(1617170403, 1), 'signature': {'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'keyId': 0}}, 'operationTime': Timestamp(1617170403, 1)}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm reluctant to include this as an example because the server needs to be started with special testing parameters enabled to be able to see this behavior.

Copy link
Member

Choose a reason for hiding this comment

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

SGTM.

>>> server_api=ServerApi('1', deprecation_errors=True)
>>> client = MongoClient(server_api=server_api)

Note that at the time of this writing, no deprecated APIs exist.
Copy link
Member

Choose a reason for hiding this comment

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

SGTM.

@@ -27,6 +27,8 @@
Declaring an API Version
````````````````````````

.. attention: Versioned API requires MongoDB >=5.0.
Copy link
Member

Choose a reason for hiding this comment

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

Does this render correctly? Other places we use two colons:

.. attention:: ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed and confirmed that it renders correctly.

@prashantmital prashantmital merged commit 1882e99 into mongodb:master Mar 31, 2021
@prashantmital prashantmital deleted the PYTHON-2536/document-versioned-API branch March 31, 2021 16:31
prashantmital added a commit that referenced this pull request Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants