Skip to content

CDRIVER-3054 fix docs and test mongoc_collection_get_last_error #1782

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
merged 6 commits into from
Nov 5, 2024

Conversation

kevinAlbs
Copy link
Collaborator

Fix documentation and add tests for mongoc_collection_get_last_error.

This PR is related to, but does not resolve CDRIVER-3054.

Verified by this patch build.

Background

mongoc_collection_get_last_error may be used to obtain results from mongoc_collection_(remove|insert|update).

mongoc_collection_get_last_error has been marked deprecated with BSON_GNUC_DEPRECATED since 1.9.0 (CDRIVER-2243) but public docs were not updated.

Note applicable operations. Remove note about unacknowledged writes. An unacknowledged write concern may still produce a non-empty document (e.g. on a network error).
Comment on lines +6 to +8
.. warning::
.. deprecated:: 1.9.0

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a replacement/recommendation to be documented with the deprecation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not currently. I do not plan to add an alternative. mongoc_collection_get_last_error has had the deprecation attribute since 1.9.0. GitHub code search shows no use of mongoc_collection_get_last_error, despite showing use of mongoc_collection_remove, mongoc_collection_insert, and mongoc_collection_update. So I expect this is non-disruptive. If there are reports requesting re-adding, a better named alternative could be considered (mongoc_collection_get_last_write_result?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Not necessarily a dedicated API to replace it, but is there a way to get the same information that this function provided?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question. Updated deprecation to note other write functions that return write results.

Copy link
Contributor

@vector-of-bool vector-of-bool left a comment

Choose a reason for hiding this comment

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

LGTM

@kevinAlbs kevinAlbs merged commit 8f24109 into mongodb:master Nov 5, 2024
43 of 45 checks passed
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