-
Type: Task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
Deprecate the following functions:
- mongoc_client_command
- mongoc_database_command
- mongoc_collection_command
Rationale
Functions are already documented as "superseded by" other functions. There are multiple unused arguments. The returned cursors can only return a single document. There are other alternatives that do not return a cursor:
mongoc_cursor_t *cursor = mongoc_client_command (client, "admin", MONGOC_QUERY_NONE /* unused */, 0 /* unused */, 0 /* unused */, 0 /* unused */, ping, NULL /* unused */, NULL /* read prefs */); if (mongoc_cursor_next (cursor, &reply)) { char *as_json = bson_as_relaxed_extended_json (reply, NULL); printf ("got reply: %s\n", as_json); bson_free (as_json); } if (mongoc_cursor_error (cursor, &error)) { printf ("error: %s\n", error.message); } mongoc_cursor_destroy (cursor);
Versus:
bool ok = mongoc_client_command_simple (client, "admin", ping, NULL /* read prefs */, &reply, &error); if (!ok) { printf ("error: %s\n", error.message); } char *as_json = bson_as_relaxed_extended_json (&reply, NULL); printf ("got reply: %s\n", as_json); bson_free (as_json);
Deprecating and future removal may enable removal of code within mongoc-cursor-cmd-deprecated.c.
- has to be done before
-
CDRIVER-5709 Remove cursor returning command helpers
- Backlog