Skip to content

CDRIVER-3991 Add versioned API connection examples #805

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 4 commits into from
Jun 25, 2021

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Jun 22, 2021

@alcaeus alcaeus requested a review from kevinAlbs June 22, 2021 12:15
@alcaeus alcaeus self-assigned this Jun 22, 2021
* For a sharded cluster, connect to the mongos instances; e.g.
* uri_sharded =
* "mongodb://mongos0.example.com:27017,mongos1.example.com:27017/";
* client = test_framework_client_new (uri_sharded);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* client = test_framework_client_new (uri_sharded);
* client = mongoc_client_new (uri_sharded);

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, great catch. I copied this from the transactions tests where this is also part of the public sample. I've changed that occurrence as well.

server_api = mongoc_server_api_new (server_api_version);

mongoc_client_set_server_api (client, server_api, &error);
/* End Versioned API Example 1 */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs a mongoc_client_destroy (client) and mongoc_server_api_destroy (server_api).

Copy link
Member Author

Choose a reason for hiding this comment

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

Added in all 4 tests (outside of the sample code)

server_api = mongoc_server_api_new (server_api_version);
mongoc_server_api_strict (server_api, true);

mongoc_client_set_server_api (client, server_api, &error);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs a mongoc_client_destroy (client) and mongoc_server_api_destroy (server_api).

mongoc_server_api_strict (server_api, false);

mongoc_client_set_server_api (client, server_api, &error);
/* End Versioned API Example 3 */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs a mongoc_client_destroy (client) and mongoc_server_api_destroy (server_api).

mongoc_server_api_deprecation_errors (server_api, true);

mongoc_client_set_server_api (client, server_api, &error);
/* End Versioned API Example 4 */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs a mongoc_client_destroy (client) and mongoc_server_api_destroy (server_api).

@@ -3648,6 +3776,7 @@ test_sample_commands (void)
if (!test_framework_max_wire_version_at_least (WIRE_VERSION_4_4)) {
test_sample_txn_commands (client);
}
test_sample_versioned_api ();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should skip on pre-5.0 servers.

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

@alcaeus alcaeus requested a review from kevinAlbs June 24, 2021 11:25
Copy link
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

LGTM

@alcaeus alcaeus merged commit 8b6ab76 into mongodb:master Jun 25, 2021
@alcaeus alcaeus deleted the cdriver-3991 branch June 25, 2021 09:24
chardan added a commit to chardan/mongo-c-driver that referenced this pull request Aug 26, 2021
…umentCount (mongodb#805)

Update Doxygen text for count_documents() to mention
estimated_document_count(), some users found it difficult to discover
one from the other.

https://jira.mongodb.org/browse/CXX-1774

Signed-off-by: Jesse Williamson <[email protected]>
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