diff --git a/NEWS b/NEWS index 4063538fde..dc11e6ebf2 100644 --- a/NEWS +++ b/NEWS @@ -95,6 +95,11 @@ Unreleased (2.0.0) * `mongoc_collection_insert_many` * `mongoc_bulkwrite_t` * `mongoc_bulk_operation_t` + * `mongoc_bulk_operation_delete` is removed. Use `mongoc_bulk_operation_remove()` instead. + * `mongoc_bulk_operation_delete_one` is removed. Use `mongoc_bulk_operation_remove_one` instead. + * `mongoc_bulk_operation_get_hint` is removed. Use `mongoc_bulk_operation_get_server_id` instead. + * `mongoc_bulk_operation_set_hint` is removed. Use `mongoc_bulk_operation_set_server_id` instead. + * `mongoc_collection_count` and `mongoc_collection_count_with_opts` are removed. Use `mongoc_collection_count_documents` or `mongoc_collection_estimated_document_count` instead. * `mongoc_collection_stats` is removed. Use the [$collStats aggregation pipeline stage](https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/) with `mongoc_collection_aggregate` instead. * `mongoc_collection_validate` is removed. Run the [validate](https://www.mongodb.com/docs/manual/reference/command/validate/) command directly with `mongoc_client_read_command_with_opts` instead. * Deprecated API for `mongoc_database_t` is removed: diff --git a/build/generate-future-functions.py b/build/generate-future-functions.py index a4088e2c2d..1fa42a5f52 100644 --- a/build/generate-future-functions.py +++ b/build/generate-future-functions.py @@ -215,27 +215,6 @@ param("const_bson_ptr", "options"), param("const_mongoc_read_prefs_ptr", "read_prefs")]), - future_function("int64_t", - "mongoc_collection_count", - [param("mongoc_collection_ptr", "collection"), - param("mongoc_query_flags_t", "flags"), - param("const_bson_ptr", "query"), - param("int64_t", "skip"), - param("int64_t", "limit"), - param("const_mongoc_read_prefs_ptr", "read_prefs"), - param("bson_error_ptr", "error")]), - - future_function("int64_t", - "mongoc_collection_count_with_opts", - [param("mongoc_collection_ptr", "collection"), - param("mongoc_query_flags_t", "flags"), - param("const_bson_ptr", "query"), - param("int64_t", "skip"), - param("int64_t", "limit"), - param("const_bson_ptr", "opts"), - param("const_mongoc_read_prefs_ptr", "read_prefs"), - param("bson_error_ptr", "error")]), - future_function("bool", "mongoc_collection_create_indexes_with_opts", [param("mongoc_collection_ptr", "collection"), diff --git a/src/libmongoc/doc/errors.rst b/src/libmongoc/doc/errors.rst index 111fa8ce1d..a460dfdc83 100644 --- a/src/libmongoc/doc/errors.rst +++ b/src/libmongoc/doc/errors.rst @@ -160,8 +160,7 @@ To fix this flaw while preserving backward compatibility, the C Driver 1.4 intro | :symbol:`mongoc_database_command_with_opts`, and | | | | other command functions | | | +------------------------------------------------------+----------------------------------------+----------------------------------------+ -| :symbol:`mongoc_collection_count_with_opts` | ``MONGOC_ERROR_QUERY`` | ``MONGOC_ERROR_SERVER`` | -| :symbol:`mongoc_client_get_database_names_with_opts`,| | | +| :symbol:`mongoc_client_get_database_names_with_opts` | ``MONGOC_ERROR_QUERY`` | ``MONGOC_ERROR_SERVER`` | | and other command helper functions | | | +------------------------------------------------------+----------------------------------------+----------------------------------------+ | :symbol:`mongoc_collection_insert_one` | ``MONGOC_ERROR_COMMAND`` | ``MONGOC_ERROR_SERVER`` | diff --git a/src/libmongoc/doc/mongoc_collection_count.rst b/src/libmongoc/doc/mongoc_collection_count.rst deleted file mode 100644 index 83a7f7d108..0000000000 --- a/src/libmongoc/doc/mongoc_collection_count.rst +++ /dev/null @@ -1,85 +0,0 @@ -:man_page: mongoc_collection_count - -mongoc_collection_count() -========================= - -.. warning:: - .. deprecated:: 1.11.0 - - Use :symbol:`mongoc_collection_count_documents` or :symbol:`mongoc_collection_estimated_document_count` instead. - - :symbol:`mongoc_collection_count_documents` has similar performance to calling :symbol:`mongoc_collection_count` with a non-NULL ``query``, and is guaranteed to retrieve an accurate collection count. See :ref:`migrating from deprecated count functions <migrating-from-deprecated-count>` for details. - - :symbol:`mongoc_collection_estimated_document_count` has the same performance as calling :symbol:`mongoc_collection_count` with a NULL ``query``, but is not guaranteed to retrieve an accurate collection count. - -.. include:: includes/retryable-read.txt - -Synopsis --------- - -.. code-block:: c - - int64_t - mongoc_collection_count (mongoc_collection_t *collection, - mongoc_query_flags_t flags, - const bson_t *query, - int64_t skip, - int64_t limit, - const mongoc_read_prefs_t *read_prefs, - bson_error_t *error); - -Parameters ----------- - -* ``collection``: A :symbol:`mongoc_collection_t`. -* ``flags``: A :symbol:`mongoc_query_flags_t`. -* ``query``: A :symbol:`bson:bson_t` containing the query. -* ``skip``: A int64_t, zero to ignore. -* ``limit``: A int64_t, zero to ignore. -* ``read_prefs``: A :symbol:`mongoc_read_prefs_t` or ``NULL``. -* ``error``: An optional location for a :symbol:`bson_error_t <errors>` or ``NULL``. - -Description ------------ - -This function shall execute a count query on the underlying 'collection'. The bson 'query' is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation. - -For more information, see the `query reference <https://www.mongodb.com/docs/manual/reference/operator/query/>`_ at the MongoDB website. - -The :symbol:`mongoc_read_concern_t` specified on the :symbol:`mongoc_collection_t` will be used, if any. If ``read_prefs`` is NULL, the collection's read preferences are used. - -Errors ------- - -Errors are propagated via the ``error`` parameter. - -Returns -------- - --1 on failure, otherwise the number of documents counted. - -Example -------- - -.. code-block:: c - - #include <bson/bson.h> - #include <mongoc/mongoc.h> - #include <stdio.h> - - static void - print_query_count (mongoc_collection_t *collection, bson_t *query) - { - bson_error_t error; - int64_t count; - - count = mongoc_collection_count ( - collection, MONGOC_QUERY_NONE, query, 0, 0, NULL, &error); - - if (count < 0) { - fprintf (stderr, "Count failed: %s\n", error.message); - } else { - printf ("%" PRId64 " documents counted.\n", count); - } - } - diff --git a/src/libmongoc/doc/mongoc_collection_count_documents.rst b/src/libmongoc/doc/mongoc_collection_count_documents.rst index 980161e923..f972421235 100644 --- a/src/libmongoc/doc/mongoc_collection_count_documents.rst +++ b/src/libmongoc/doc/mongoc_collection_count_documents.rst @@ -76,29 +76,6 @@ Example } } -.. _migrating-from-deprecated-count: - -Migrating from deprecated count functions ------------------------------------------ - -When migrating to :symbol:`mongoc_collection_count_documents` from the deprecated :symbol:`mongoc_collection_count` or :symbol:`mongoc_collection_count_with_opts`, the following query operators in the filter must be replaced: - -+-------------+-------------------------------------+ -| Operator | Replacement | -+=============+=====================================+ -| $where | `$expr`_ | -+-------------+-------------------------------------+ -| $near | `$geoWithin`_ with `$center`_ | -+-------------+-------------------------------------+ -| $nearSphere | `$geoWithin`_ with `$centerSphere`_ | -+-------------+-------------------------------------+ - -$expr requires MongoDB 3.6+ - -.. _$expr: https://www.mongodb.com/docs/manual/reference/operator/query/expr/ -.. _$geoWithin: https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/ -.. _$center: https://www.mongodb.com/docs/manual/reference/operator/query/center/#op._S_center -.. _$centerSphere: https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/#op._S_centerSphere .. seealso:: diff --git a/src/libmongoc/doc/mongoc_collection_count_with_opts.rst b/src/libmongoc/doc/mongoc_collection_count_with_opts.rst deleted file mode 100644 index 17312e832c..0000000000 --- a/src/libmongoc/doc/mongoc_collection_count_with_opts.rst +++ /dev/null @@ -1,139 +0,0 @@ -:man_page: mongoc_collection_count_with_opts - -mongoc_collection_count_with_opts() -=================================== - -.. warning:: - .. deprecated:: 1.11.0 - - Use :symbol:`mongoc_collection_count_documents` or :symbol:`mongoc_collection_estimated_document_count` instead. - - :symbol:`mongoc_collection_count_documents` has similar performance to calling :symbol:`mongoc_collection_count` with a non-NULL ``query``, and is guaranteed to retrieve an accurate collection count. See :ref:`migrating from deprecated count functions <migrating-from-deprecated-count>` for details. - - :symbol:`mongoc_collection_estimated_document_count` has the same performance as calling :symbol:`mongoc_collection_count` with a NULL ``query``, but is not guaranteed to retrieve an accurate collection count. - -Synopsis --------- - -.. code-block:: c - - int64_t - mongoc_collection_count_with_opts (mongoc_collection_t *collection, - mongoc_query_flags_t flags, - const bson_t *query, - int64_t skip, - int64_t limit, - const bson_t *opts, - const mongoc_read_prefs_t *read_prefs, - bson_error_t *error); - -Parameters ----------- - -* ``collection``: A :symbol:`mongoc_collection_t`. -* ``flags``: A :symbol:`mongoc_query_flags_t`. -* ``query``: A :symbol:`bson:bson_t` containing the query. -* ``skip``: A int64_t, zero to ignore. -* ``limit``: A int64_t, zero to ignore. -* ``opts``: A :symbol:`bson:bson_t`, ``NULL`` to ignore. -* ``read_prefs``: An optional :symbol:`mongoc_read_prefs_t`, otherwise uses the collection's read preference. -* ``error``: An optional location for a :symbol:`bson_error_t <errors>` or ``NULL``. - -.. |opts-source| replace:: ``collection`` - -.. include:: includes/read-opts.txt - -Description ------------ - -This function shall execute a count query on the underlying 'collection'. The bson 'query' is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation. - -The :symbol:`mongoc_read_concern_t` specified on the :symbol:`mongoc_collection_t` will be used, if any. If ``read_prefs`` is NULL, the collection's read preferences are used. - -In addition to the standard functionality available from mongoc_collection_count, this function allows the user to add arbitrary extra keys to the count. This pass through enables features such as hinting for counts. - -For more information, see the `query reference <https://www.mongodb.com/docs/manual/reference/operator/query/>`_ at the MongoDB website. - -.. include:: includes/retryable-read.txt - -Errors ------- - -Errors are propagated via the ``error`` parameter. - -Returns -------- - --1 on failure, otherwise the number of documents counted. - -Examples --------- - -.. code-block:: c - :caption: Basic Counting - - #include <bson/bson.h> - #include <mongoc/mongoc.h> - #include <stdio.h> - - static void - print_query_count (mongoc_collection_t *collection, bson_t *query) - { - bson_error_t error; - int64_t count; - bson_t opts; - - bson_init (&opts); - BSON_APPEND_UTF8 (&opts, "hint", "_id_"); - - count = mongoc_collection_count_with_opts ( - collection, MONGOC_QUERY_NONE, query, 0, 0, &opts, NULL, &error); - - bson_destroy (&opts); - - if (count < 0) { - fprintf (stderr, "Count failed: %s\n", error.message); - } else { - printf ("%" PRId64 " documents counted.\n", count); - } - } - -.. code-block:: c - :caption: Counting with Collation - - #include <bson/bson.h> - #include <mongoc/mongoc.h> - #include <stdio.h> - - static void - print_query_count (mongoc_collection_t *collection, bson_t *query) - { - bson_t *selector; - bson_t *opts; - bson_error_t error; - int64_t count; - - selector = BCON_NEW ("_id", "{", "$gt", BCON_UTF8 ("one"), "}"); - - /* "One" normally sorts before "one"; make "one" come first */ - opts = BCON_NEW ("collation", - "{", - "locale", - BCON_UTF8 ("en_US"), - "caseFirst", - BCON_UTF8 ("lower"), - "}"); - - count = mongoc_collection_count_with_opts ( - collection, MONGOC_QUERY_NONE, query, 0, 0, opts, NULL, &error); - - bson_destroy (selector); - bson_destroy (opts); - - if (count < 0) { - fprintf (stderr, "Count failed: %s\n", error.message); - } else { - printf ("%" PRId64 " documents counted.\n", count); - } - } - diff --git a/src/libmongoc/doc/mongoc_collection_t.rst b/src/libmongoc/doc/mongoc_collection_t.rst index c8868df58d..401c2b08f2 100644 --- a/src/libmongoc/doc/mongoc_collection_t.rst +++ b/src/libmongoc/doc/mongoc_collection_t.rst @@ -32,8 +32,6 @@ Read preferences and write concerns are inherited from the parent client. They c mongoc_collection_copy mongoc_collection_count_documents mongoc_collection_estimated_document_count - mongoc_collection_count - mongoc_collection_count_with_opts mongoc_collection_create_bulk_operation_with_opts mongoc_collection_create_indexes_with_opts mongoc_collection_delete_many diff --git a/src/libmongoc/src/mongoc/mongoc-collection.c b/src/libmongoc/src/mongoc/mongoc-collection.c index 418374267a..21f04d8f72 100644 --- a/src/libmongoc/src/mongoc/mongoc-collection.c +++ b/src/libmongoc/src/mongoc/mongoc-collection.c @@ -473,117 +473,6 @@ mongoc_collection_command_simple (mongoc_collection_t *collection, error); } -/* - *-------------------------------------------------------------------------- - * - * mongoc_collection_count -- - * - * Count the number of documents matching @query. - * - * Parameters: - * @flags: A mongoc_query_flags_t describing the query flags or 0. - * @query: The query to perform or NULL for {}. - * @skip: The $skip to perform within the query or 0. - * @limit: The $limit to perform within the query or 0. - * @read_prefs: desired read preferences or NULL. - * @error: A location for an error or NULL. - * - * Returns: - * -1 on failure; otherwise the number of matching documents. - * - * Side effects: - * @error is set upon failure if non-NULL. - * - *-------------------------------------------------------------------------- - */ - -int64_t -mongoc_collection_count (mongoc_collection_t *collection, /* IN */ - mongoc_query_flags_t flags, /* IN */ - const bson_t *query, /* IN */ - int64_t skip, /* IN */ - int64_t limit, /* IN */ - const mongoc_read_prefs_t *read_prefs, /* IN */ - bson_error_t *error) /* OUT */ -{ - int64_t ret; - bson_t opts = BSON_INITIALIZER; - - /* Complex types must be parts of `opts`, otherwise we can't - * follow various specs that require validation etc */ - if (collection->read_concern->level != NULL) { - const bson_t *read_concern_bson; - - read_concern_bson = _mongoc_read_concern_get_bson (collection->read_concern); - BSON_APPEND_DOCUMENT (&opts, "readConcern", read_concern_bson); - } - - /* Server Selection Spec: "may-use-secondary" commands SHOULD take a read - * preference argument and otherwise MUST use the default read preference - * from client, database or collection configuration. */ - BEGIN_IGNORE_DEPRECATIONS - ret = mongoc_collection_count_with_opts (collection, flags, query, skip, limit, &opts, read_prefs, error); - END_IGNORE_DEPRECATIONS - - bson_destroy (&opts); - return ret; -} - - -int64_t -mongoc_collection_count_with_opts (mongoc_collection_t *collection, /* IN */ - mongoc_query_flags_t flags, /* IN */ - const bson_t *query, /* IN */ - int64_t skip, /* IN */ - int64_t limit, /* IN */ - const bson_t *opts, /* IN */ - const mongoc_read_prefs_t *read_prefs, /* IN */ - bson_error_t *error) /* OUT */ -{ - bson_iter_t iter; - int64_t ret = -1; - bool success; - bson_t reply; - bson_t cmd = BSON_INITIALIZER; - - ENTRY; - - BSON_ASSERT_PARAM (collection); - - bsonBuildAppend (cmd, - kv ("count", utf8_w_len (collection->collection, collection->collectionlen)), - kv ("query", - if (query, // If we have a query, - then (bson (*query)), // Copy it - else (doc ()))), // Otherwise, add an empty doc - if (limit, then (kv ("limit", int64 (limit)))), - if (skip, then (kv ("skip", int64 (skip))))); - - - success = _mongoc_client_command_with_opts (collection->client, - collection->db, - &cmd, - MONGOC_CMD_READ, - opts, - flags, - read_prefs, - collection->read_prefs, - collection->read_concern, - collection->write_concern, - &reply, - error); - - if (success) { - if (bson_iter_init_find (&iter, &reply, "n")) { - ret = bson_iter_as_int64 (&iter); - } - } - - bson_destroy (&reply); - bson_destroy (&cmd); - - RETURN (ret); -} int64_t mongoc_collection_estimated_document_count (mongoc_collection_t *coll, diff --git a/src/libmongoc/src/mongoc/mongoc-collection.h b/src/libmongoc/src/mongoc/mongoc-collection.h index 23b676b066..c6472aa4a3 100644 --- a/src/libmongoc/src/mongoc/mongoc-collection.h +++ b/src/libmongoc/src/mongoc/mongoc-collection.h @@ -85,25 +85,6 @@ mongoc_collection_command_simple (mongoc_collection_t *collection, bson_t *reply, bson_error_t *error); -BSON_DEPRECATED_FOR (mongoc_collection_count_documents or mongoc_collection_estimated_document_count) -MONGOC_EXPORT (int64_t) mongoc_collection_count (mongoc_collection_t *collection, - mongoc_query_flags_t flags, - const bson_t *query, - int64_t skip, - int64_t limit, - const mongoc_read_prefs_t *read_prefs, - bson_error_t *error); - -BSON_DEPRECATED_FOR (mongoc_collection_count_documents or mongoc_collection_estimated_document_count) -MONGOC_EXPORT (int64_t) mongoc_collection_count_with_opts (mongoc_collection_t *collection, - mongoc_query_flags_t flags, - const bson_t *query, - int64_t skip, - int64_t limit, - const bson_t *opts, - const mongoc_read_prefs_t *read_prefs, - bson_error_t *error); - MONGOC_EXPORT (bool) mongoc_collection_drop (mongoc_collection_t *collection, bson_error_t *error); diff --git a/src/libmongoc/tests/json-test-operations.c b/src/libmongoc/tests/json-test-operations.c index 809ed93242..04885f07a3 100644 --- a/src/libmongoc/tests/json-test-operations.c +++ b/src/libmongoc/tests/json-test-operations.c @@ -1229,10 +1229,20 @@ count (mongoc_collection_t *collection, } else if (!strcmp (name, "estimatedDocumentCount")) { r = mongoc_collection_estimated_document_count (collection, &opts, read_prefs, reply, &error); } else if (!strcmp (name, "count")) { - /* deprecated old count function */ - r = mongoc_collection_count_with_opts (collection, MONGOC_QUERY_NONE, &filter, 0, 0, &opts, read_prefs, &error); - /* fake a reply for the test framework's sake */ - bson_init (reply); + // "count" previously referred to the deprecated helper: `mongoc_collection_count_with_opts`. + // Run the "count" command directly to support tests. See: CRUD spec "Count API Details". + bson_t *cmd = BCON_NEW ("count", mongoc_collection_get_name (collection)); + BSON_ASSERT (BSON_APPEND_DOCUMENT (cmd, "query", &filter)); + bool ok = mongoc_collection_read_command_with_opts (collection, cmd, read_prefs, &opts, reply, &error); + if (!ok) { + // Set resulting count to -1 to indicate failure. + r = -1; + } else { + bson_iter_t iter; + BSON_ASSERT (bson_iter_init_find (&iter, reply, "n")); + r = bson_iter_as_int64 (&iter); + } + bson_destroy (cmd); } else { test_error ("count() called with unrecognized operation name %s", name); return false; diff --git a/src/libmongoc/tests/mock_server/future-functions.c b/src/libmongoc/tests/mock_server/future-functions.c index e6c424cc78..0c609dccbc 100644 --- a/src/libmongoc/tests/mock_server/future-functions.c +++ b/src/libmongoc/tests/mock_server/future-functions.c @@ -301,57 +301,6 @@ BSON_THREAD_FUN (background_mongoc_collection_aggregate, data) BSON_THREAD_RETURN; } -static -BSON_THREAD_FUN (background_mongoc_collection_count, data) -{ - future_t *future = (future_t *) data; - future_value_t return_value; - - return_value.type = future_value_int64_t_type; - - future_value_set_int64_t ( - &return_value, - mongoc_collection_count ( - future_value_get_mongoc_collection_ptr (future_get_param (future, 0)), - future_value_get_mongoc_query_flags_t (future_get_param (future, 1)), - future_value_get_const_bson_ptr (future_get_param (future, 2)), - future_value_get_int64_t (future_get_param (future, 3)), - future_value_get_int64_t (future_get_param (future, 4)), - future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 5)), - future_value_get_bson_error_ptr (future_get_param (future, 6)) - )); - - future_resolve (future, return_value); - - BSON_THREAD_RETURN; -} - -static -BSON_THREAD_FUN (background_mongoc_collection_count_with_opts, data) -{ - future_t *future = (future_t *) data; - future_value_t return_value; - - return_value.type = future_value_int64_t_type; - - future_value_set_int64_t ( - &return_value, - mongoc_collection_count_with_opts ( - future_value_get_mongoc_collection_ptr (future_get_param (future, 0)), - future_value_get_mongoc_query_flags_t (future_get_param (future, 1)), - future_value_get_const_bson_ptr (future_get_param (future, 2)), - future_value_get_int64_t (future_get_param (future, 3)), - future_value_get_int64_t (future_get_param (future, 4)), - future_value_get_const_bson_ptr (future_get_param (future, 5)), - future_value_get_const_mongoc_read_prefs_ptr (future_get_param (future, 6)), - future_value_get_bson_error_ptr (future_get_param (future, 7)) - )); - - future_resolve (future, return_value); - - BSON_THREAD_RETURN; -} - static BSON_THREAD_FUN (background_mongoc_collection_create_indexes_with_opts, data) { @@ -1597,86 +1546,6 @@ future_collection_aggregate ( return future; } -future_t * -future_collection_count ( - mongoc_collection_ptr collection, - mongoc_query_flags_t flags, - const_bson_ptr query, - int64_t skip, - int64_t limit, - const_mongoc_read_prefs_ptr read_prefs, - bson_error_ptr error) -{ - future_t *future = future_new (future_value_int64_t_type, - 7); - - future_value_set_mongoc_collection_ptr ( - future_get_param (future, 0), collection); - - future_value_set_mongoc_query_flags_t ( - future_get_param (future, 1), flags); - - future_value_set_const_bson_ptr ( - future_get_param (future, 2), query); - - future_value_set_int64_t ( - future_get_param (future, 3), skip); - - future_value_set_int64_t ( - future_get_param (future, 4), limit); - - future_value_set_const_mongoc_read_prefs_ptr ( - future_get_param (future, 5), read_prefs); - - future_value_set_bson_error_ptr ( - future_get_param (future, 6), error); - - future_start (future, background_mongoc_collection_count); - return future; -} - -future_t * -future_collection_count_with_opts ( - mongoc_collection_ptr collection, - mongoc_query_flags_t flags, - const_bson_ptr query, - int64_t skip, - int64_t limit, - const_bson_ptr opts, - const_mongoc_read_prefs_ptr read_prefs, - bson_error_ptr error) -{ - future_t *future = future_new (future_value_int64_t_type, - 8); - - future_value_set_mongoc_collection_ptr ( - future_get_param (future, 0), collection); - - future_value_set_mongoc_query_flags_t ( - future_get_param (future, 1), flags); - - future_value_set_const_bson_ptr ( - future_get_param (future, 2), query); - - future_value_set_int64_t ( - future_get_param (future, 3), skip); - - future_value_set_int64_t ( - future_get_param (future, 4), limit); - - future_value_set_const_bson_ptr ( - future_get_param (future, 5), opts); - - future_value_set_const_mongoc_read_prefs_ptr ( - future_get_param (future, 6), read_prefs); - - future_value_set_bson_error_ptr ( - future_get_param (future, 7), error); - - future_start (future, background_mongoc_collection_count_with_opts); - return future; -} - future_t * future_collection_create_indexes_with_opts ( mongoc_collection_ptr collection, diff --git a/src/libmongoc/tests/mock_server/future-functions.h b/src/libmongoc/tests/mock_server/future-functions.h index 1a46c21a56..4ec1531b44 100644 --- a/src/libmongoc/tests/mock_server/future-functions.h +++ b/src/libmongoc/tests/mock_server/future-functions.h @@ -149,33 +149,6 @@ future_collection_aggregate ( ); -future_t * -future_collection_count ( - - mongoc_collection_ptr collection, - mongoc_query_flags_t flags, - const_bson_ptr query, - int64_t skip, - int64_t limit, - const_mongoc_read_prefs_ptr read_prefs, - bson_error_ptr error -); - - -future_t * -future_collection_count_with_opts ( - - mongoc_collection_ptr collection, - mongoc_query_flags_t flags, - const_bson_ptr query, - int64_t skip, - int64_t limit, - const_bson_ptr opts, - const_mongoc_read_prefs_ptr read_prefs, - bson_error_ptr error -); - - future_t * future_collection_create_indexes_with_opts ( diff --git a/src/libmongoc/tests/test-mongoc-client-session.c b/src/libmongoc/tests/test-mongoc-client-session.c index 6b661d9200..32fb399712 100644 --- a/src/libmongoc/tests/test-mongoc-client-session.c +++ b/src/libmongoc/tests/test-mongoc-client-session.c @@ -1600,15 +1600,6 @@ run_session_test_bulk_operation (void *ctx) } -static void -run_count_test (void *ctx) -{ - /* CDRIVER-3612: mongoc_collection_estimated_document_count does not support - * explicit sessions */ - _test_implicit_session_lsid (((session_test_helper_t *) ctx)->test_fn); -} - - static void insert_10_docs (session_test_t *test) { @@ -1681,14 +1672,6 @@ test_db_cmd (session_test_t *test) } -static void -test_count (session_test_t *test) -{ - test->succeeded = (-1 != mongoc_collection_count_with_opts ( - test->collection, MONGOC_QUERY_NONE, NULL, 0, 0, &test->opts, NULL, &test->error)); -} - - static void test_cursor (session_test_t *test) { @@ -2747,17 +2730,6 @@ test_session_install (TestSuite *suite) add_session_test (suite, "/Session/write_cmd", test_write_cmd, false); add_session_test (suite, "/Session/read_write_cmd", test_read_write_cmd, true); add_session_test (suite, "/Session/db_cmd", test_db_cmd, false); - { - session_test_helper_t *const helper = bson_malloc (sizeof (*helper)); - *helper = (session_test_helper_t){.test_fn = test_count}; - TestSuite_AddFull (suite, - "/Session/count", - run_count_test, - bson_free, - helper, - test_framework_skip_if_no_cluster_time, - test_framework_skip_if_no_crypto); - } add_session_test (suite, "/Session/cursor", test_cursor, true); add_session_test (suite, "/Session/drop", test_drop, false); add_session_test (suite, "/Session/drop_index", test_drop_index, false); diff --git a/src/libmongoc/tests/test-mongoc-collection.c b/src/libmongoc/tests/test-mongoc-collection.c index caa4acdff4..3f51ff853c 100644 --- a/src/libmongoc/tests/test-mongoc-collection.c +++ b/src/libmongoc/tests/test-mongoc-collection.c @@ -336,10 +336,6 @@ test_read_prefs_is_valid (void *ctx) ASSERT (!mongoc_collection_command_simple (collection, tmp_bson ("{'ping': 1}"), read_prefs, &reply, &error)); bson_destroy (&reply); - /* mongoc_collection_count_with_opts */ - ASSERT (mongoc_collection_count_with_opts ( - collection, MONGOC_QUERY_NONE, tmp_bson ("{}"), 0, 0, NULL, read_prefs, &error) == -1); - /* mongoc_collection_find_with_opts */ cursor = mongoc_collection_find_with_opts (collection, tmp_bson ("{}"), NULL, read_prefs); @@ -363,10 +359,6 @@ test_read_prefs_is_valid (void *ctx) ASSERT_OR_PRINT (mongoc_collection_command_simple (collection, tmp_bson ("{'ping': 1}"), read_prefs, &reply, &error), error); bson_destroy (&reply); - /* mongoc_collection_count_with_opts */ - ASSERT_OR_PRINT (mongoc_collection_count_with_opts ( - collection, MONGOC_QUERY_NONE, tmp_bson ("{}"), 0, 0, NULL, read_prefs, &error) != -1, - error); /* mongoc_collection_find_with_opts */ cursor = mongoc_collection_find_with_opts (collection, tmp_bson ("{}"), NULL, read_prefs); @@ -1661,304 +1653,6 @@ test_index_storage (void) mongoc_client_destroy (client); } -static void -test_count (void) -{ - mongoc_collection_t *collection; - mongoc_client_t *client; - bson_error_t error; - int64_t count; - bson_t b; - - client = test_framework_new_default_client (); - ASSERT (client); - - collection = mongoc_client_get_collection (client, "test", "test"); - ASSERT (collection); - - bson_init (&b); - count = mongoc_collection_count (collection, MONGOC_QUERY_NONE, &b, 0, 0, NULL, &error); - bson_destroy (&b); - - if (count == -1) { - MONGOC_WARNING ("%s\n", error.message); - } - ASSERT (count != -1); - - mongoc_collection_destroy (collection); - mongoc_client_destroy (client); -} - - -static void -test_count_read_pref (void) -{ - mock_server_t *server; - mongoc_collection_t *collection; - mongoc_client_t *client; - mongoc_read_prefs_t *prefs; - future_t *future; - request_t *request; - bson_error_t error; - - server = mock_mongos_new (WIRE_VERSION_MIN); - mock_server_run (server); - mock_server_auto_endsessions (server); - client = test_framework_client_new_from_uri (mock_server_get_uri (server), NULL); - collection = mongoc_client_get_collection (client, "db", "collection"); - prefs = mongoc_read_prefs_new (MONGOC_READ_SECONDARY); - - mongoc_collection_set_read_prefs (collection, prefs); - future = future_collection_count (collection, MONGOC_QUERY_NONE, NULL, 0, 0, NULL, &error); - request = mock_server_receives_msg (server, - MONGOC_MSG_NONE, - tmp_bson ("{'$db': 'db'," - " 'count': 'collection'," - " '$readPreference': {'mode': 'secondary'}}")); - - reply_to_request_simple (request, "{'ok': 1, 'n': 1}"); - ASSERT_OR_PRINT (1 == future_get_int64_t (future), error); - - request_destroy (request); - future_destroy (future); - mongoc_read_prefs_destroy (prefs); - mongoc_collection_destroy (collection); - mongoc_client_destroy (client); - mock_server_destroy (server); -} - - -static void -test_count_read_concern (void) -{ - mongoc_collection_t *collection; - mongoc_client_t *client; - mongoc_read_concern_t *rc; - mock_server_t *server; - request_t *request; - bson_error_t error; - future_t *future; - int64_t count; - bson_t b; - - server = mock_server_with_auto_hello (WIRE_VERSION_MIN); - mock_server_run (server); - client = test_framework_client_new_from_uri (mock_server_get_uri (server), NULL); - ASSERT (client); - - collection = mongoc_client_get_collection (client, "test", "test"); - ASSERT (collection); - - bson_init (&b); - future = future_collection_count (collection, MONGOC_QUERY_NONE, &b, 0, 0, NULL, &error); - bson_destroy (&b); - request = - mock_server_receives_msg (server, MONGOC_MSG_NONE, tmp_bson ("{'$db': 'test', 'count': 'test', 'query': {}}")); - - reply_to_request_simple (request, "{ 'n' : 42, 'ok' : 1 } "); - count = future_get_int64_t (future); - ASSERT_OR_PRINT (count == 42, error); - request_destroy (request); - future_destroy (future); - - /* readConcern: { level: majority } */ - rc = mongoc_read_concern_new (); - mongoc_read_concern_set_level (rc, MONGOC_READ_CONCERN_LEVEL_MAJORITY); - mongoc_collection_set_read_concern (collection, rc); - - bson_init (&b); - future = future_collection_count (collection, MONGOC_QUERY_NONE, &b, 0, 0, NULL, &error); - bson_destroy (&b); - request = mock_server_receives_msg (server, - MONGOC_MSG_NONE, - tmp_bson ("{'$db': 'test'," - " 'count': 'test'," - " 'query': {}," - " 'readConcern': {'level': 'majority'}}")); - - reply_to_request_simple (request, "{ 'n' : 43, 'ok' : 1 } "); - count = future_get_int64_t (future); - ASSERT_OR_PRINT (count == 43, error); - mongoc_read_concern_destroy (rc); - request_destroy (request); - future_destroy (future); - - /* readConcern: { level: local } */ - rc = mongoc_read_concern_new (); - mongoc_read_concern_set_level (rc, MONGOC_READ_CONCERN_LEVEL_LOCAL); - mongoc_collection_set_read_concern (collection, rc); - - bson_init (&b); - future = future_collection_count (collection, MONGOC_QUERY_NONE, &b, 0, 0, NULL, &error); - bson_destroy (&b); - request = mock_server_receives_msg (server, - MONGOC_MSG_NONE, - tmp_bson ("{'$db': 'test'," - " 'count': 'test'," - " 'query': {}," - " 'readConcern': {'level': 'local'}}")); - - reply_to_request_simple (request, "{ 'n' : 44, 'ok' : 1 } "); - count = future_get_int64_t (future); - ASSERT_OR_PRINT (count == 44, error); - mongoc_read_concern_destroy (rc); - request_destroy (request); - future_destroy (future); - - /* readConcern: { level: futureCompatible } */ - rc = mongoc_read_concern_new (); - mongoc_read_concern_set_level (rc, "futureCompatible"); - mongoc_collection_set_read_concern (collection, rc); - - bson_init (&b); - future = future_collection_count (collection, MONGOC_QUERY_NONE, &b, 0, 0, NULL, &error); - bson_destroy (&b); - request = mock_server_receives_msg (server, - MONGOC_MSG_NONE, - tmp_bson ("{'$db': 'test'," - " 'count': 'test'," - " 'query': {}," - " 'readConcern': {'level': 'futureCompatible'}}")); - - reply_to_request_simple (request, "{ 'n' : 45, 'ok' : 1 } "); - count = future_get_int64_t (future); - ASSERT_OR_PRINT (count == 45, error); - mongoc_read_concern_destroy (rc); - request_destroy (request); - future_destroy (future); - - /* Setting readConcern to NULL should not send readConcern */ - rc = mongoc_read_concern_new (); - mongoc_read_concern_set_level (rc, NULL); - mongoc_collection_set_read_concern (collection, rc); - - bson_init (&b); - future = future_collection_count (collection, MONGOC_QUERY_NONE, &b, 0, 0, NULL, &error); - bson_destroy (&b); - request = mock_server_receives_msg (server, - MONGOC_MSG_NONE, - tmp_bson ("{'$db': 'test'," - " 'count': 'test'," - " 'query': {}," - " 'readConcern': { '$exists': false }}")); - - reply_to_request_simple (request, "{ 'n' : 46, 'ok' : 1 } "); - count = future_get_int64_t (future); - ASSERT_OR_PRINT (count == 46, error); - mongoc_read_concern_destroy (rc); - request_destroy (request); - future_destroy (future); - - /* Fresh read_concern should not send readConcern */ - rc = mongoc_read_concern_new (); - mongoc_collection_set_read_concern (collection, rc); - - bson_init (&b); - future = future_collection_count (collection, MONGOC_QUERY_NONE, &b, 0, 0, NULL, &error); - bson_destroy (&b); - request = mock_server_receives_msg (server, - MONGOC_MSG_NONE, - tmp_bson ("{'$db': 'test'," - " 'count': 'test'," - " 'query': {}," - " 'readConcern': { '$exists': false }}")); - - reply_to_request_simple (request, "{ 'n' : 47, 'ok' : 1 } "); - count = future_get_int64_t (future); - ASSERT_OR_PRINT (count == 47, error); - - mongoc_read_concern_destroy (rc); - request_destroy (request); - future_destroy (future); - mongoc_collection_destroy (collection); - mongoc_client_destroy (client); - mock_server_destroy (server); -} - - -static void -test_count_read_concern_live (void *unused) -{ - mongoc_collection_t *collection; - mongoc_client_t *client; - mongoc_read_concern_t *rc; - bson_error_t error; - int64_t count; - bson_t b; - - BSON_UNUSED (unused); - - client = test_framework_new_default_client (); - ASSERT (client); - - collection = mongoc_client_get_collection (client, "test", "test"); - ASSERT (collection); - - // Drop collection. - // Use writeConcern=majority so later readConcern=majority observes dropped - // collection. - { - mongoc_write_concern_t *wc = mongoc_write_concern_new (); - mongoc_write_concern_set_w (wc, MONGOC_WRITE_CONCERN_W_MAJORITY); - bson_t drop_opts = BSON_INITIALIZER; - mongoc_write_concern_append (wc, &drop_opts); - if (!mongoc_collection_drop_with_opts (collection, &drop_opts, &error)) { - // Ignore an "ns not found" error. - if (NULL == strstr (error.message, "ns not found")) { - ASSERT_OR_PRINT (false, error); - } - } - - bson_destroy (&drop_opts); - mongoc_write_concern_destroy (wc); - } - - bson_init (&b); - count = mongoc_collection_count (collection, MONGOC_QUERY_NONE, &b, 0, 0, NULL, &error); - bson_destroy (&b); - ASSERT_OR_PRINT (count != -1, error); - ASSERT_CMPINT64 (count, ==, 0); - - /* Setting readConcern to NULL should not send readConcern */ - rc = mongoc_read_concern_new (); - mongoc_read_concern_set_level (rc, NULL); - mongoc_collection_set_read_concern (collection, rc); - - bson_init (&b); - count = mongoc_collection_count (collection, MONGOC_QUERY_NONE, &b, 0, 0, NULL, &error); - bson_destroy (&b); - ASSERT_OR_PRINT (count != -1, error); - ASSERT_CMPINT64 (count, ==, 0); - mongoc_read_concern_destroy (rc); - - /* readConcern: { level: local } should raise error pre 3.2 */ - rc = mongoc_read_concern_new (); - mongoc_read_concern_set_level (rc, MONGOC_READ_CONCERN_LEVEL_LOCAL); - mongoc_collection_set_read_concern (collection, rc); - - bson_init (&b); - count = mongoc_collection_count (collection, MONGOC_QUERY_NONE, &b, 0, 0, NULL, &error); - bson_destroy (&b); - ASSERT_OR_PRINT (count != -1, error); - ASSERT_CMPINT64 (count, ==, 0); - mongoc_read_concern_destroy (rc); - - /* readConcern: { level: majority } should raise error pre 3.2 */ - rc = mongoc_read_concern_new (); - mongoc_read_concern_set_level (rc, MONGOC_READ_CONCERN_LEVEL_MAJORITY); - mongoc_collection_set_read_concern (collection, rc); - - bson_init (&b); - count = mongoc_collection_count (collection, MONGOC_QUERY_NONE, &b, 0, 0, NULL, &error); - bson_destroy (&b); - ASSERT_OR_PRINT (count != -1, error); - ASSERT_CMPINT64 (count, ==, 0); - mongoc_read_concern_destroy (rc); - - mongoc_collection_destroy (collection); - mongoc_client_destroy (client); -} - int skip_unless_server_has_decimal128 (void) { @@ -1981,76 +1675,6 @@ mongod_supports_majority_read_concern (void) } -static void -test_count_with_opts (void) -{ - mock_server_t *server; - mongoc_collection_t *collection; - mongoc_client_t *client; - future_t *future; - request_t *request; - bson_error_t error; - - /* use a mongos since we don't send SECONDARY_OK to mongos by default */ - server = mock_mongos_new (WIRE_VERSION_MIN); - mock_server_run (server); - mock_server_auto_endsessions (server); - client = test_framework_client_new_from_uri (mock_server_get_uri (server), NULL); - collection = mongoc_client_get_collection (client, "db", "collection"); - - future = future_collection_count_with_opts ( - collection, MONGOC_QUERY_SECONDARY_OK, NULL, 0, 0, tmp_bson ("{'opt': 1}"), NULL, &error); - - request = - mock_server_receives_msg (server, MONGOC_MSG_NONE, tmp_bson ("{'$db': 'db', 'count': 'collection', 'opt': 1}")); - - reply_to_request_simple (request, "{'ok': 1, 'n': 1}"); - ASSERT_OR_PRINT (1 == future_get_int64_t (future), error); - - request_destroy (request); - future_destroy (future); - mongoc_collection_destroy (collection); - mongoc_client_destroy (client); - mock_server_destroy (server); -} - - -static void -test_count_with_collation (void) -{ - mock_server_t *server; - mongoc_collection_t *collection; - mongoc_client_t *client; - future_t *future; - request_t *request; - bson_error_t error; - - server = mock_server_with_auto_hello (WIRE_VERSION_MIN); - mock_server_run (server); - - client = test_framework_client_new_from_uri (mock_server_get_uri (server), NULL); - collection = mongoc_client_get_collection (client, "db", "collection"); - - future = future_collection_count_with_opts ( - collection, MONGOC_QUERY_SECONDARY_OK, NULL, 0, 0, tmp_bson ("{'collation': {'locale': 'en'}}"), NULL, &error); - - request = mock_server_receives_msg (server, - MONGOC_MSG_NONE, - tmp_bson ("{'$db': 'db'," - " 'count': 'collection'," - " 'collation': {'locale': 'en'}}")); - reply_to_request_simple (request, "{'ok': 1, 'n': 1}"); - ASSERT_OR_PRINT (1 == future_get_int64_t (future), error); - request_destroy (request); - - - future_destroy (future); - mongoc_collection_destroy (collection); - mongoc_client_destroy (client); - mock_server_destroy (server); -} - - static void test_count_documents (void) { @@ -5321,17 +4945,6 @@ test_collection_install (TestSuite *suite) TestSuite_AddLive (suite, "/Collection/remove/multi", test_remove_multi); TestSuite_AddFull ( suite, "/Collection/remove/oversize", test_remove_oversize, NULL, NULL, test_framework_skip_if_slow_or_live); - TestSuite_AddLive (suite, "/Collection/count", test_count); - TestSuite_AddMockServerTest (suite, "/Collection/count_with_opts", test_count_with_opts); - TestSuite_AddMockServerTest (suite, "/Collection/count/read_pref", test_count_read_pref); - TestSuite_AddMockServerTest (suite, "/Collection/count/read_concern", test_count_read_concern); - TestSuite_AddMockServerTest (suite, "/Collection/count/collation", test_count_with_collation); - TestSuite_AddFull (suite, - "/Collection/count/read_concern_live", - test_count_read_concern_live, - NULL, - NULL, - mongod_supports_majority_read_concern); TestSuite_AddLive (suite, "/Collection/drop", test_drop); TestSuite_AddLive (suite, "/Collection/aggregate", test_aggregate); TestSuite_AddMockServerTest (suite, "/Collection/aggregate/inherit/collection", test_aggregate_inherit_collection); diff --git a/src/libmongoc/tests/test-mongoc-hedged-reads.c b/src/libmongoc/tests/test-mongoc-hedged-reads.c index 642c10815a..e6b4864c69 100644 --- a/src/libmongoc/tests/test-mongoc-hedged-reads.c +++ b/src/libmongoc/tests/test-mongoc-hedged-reads.c @@ -49,7 +49,7 @@ test_mongos_hedged_reads_read_pref (void) * readPreference. */ mongoc_collection_set_read_prefs (collection, prefs); - future = future_collection_count (collection, MONGOC_QUERY_NONE, NULL, 0, 0, NULL, &error); + future = future_collection_estimated_document_count (collection, NULL, prefs, NULL, &error); request = mock_server_receives_msg (server, MONGOC_MSG_NONE, tmp_bson ("{'$db': 'db'," @@ -68,7 +68,7 @@ test_mongos_hedged_reads_read_pref (void) mongoc_read_prefs_set_hedge (prefs, &hedge_doc); mongoc_collection_set_read_prefs (collection, prefs); - future = future_collection_count (collection, MONGOC_QUERY_NONE, NULL, 0, 0, NULL, &error); + future = future_collection_estimated_document_count (collection, NULL, prefs, NULL, &error); request = mock_server_receives_msg (server, MONGOC_MSG_NONE, tmp_bson ("{'$db': 'db'," diff --git a/src/libmongoc/tests/test-mongoc-max-staleness.c b/src/libmongoc/tests/test-mongoc-max-staleness.c index a812235e30..da7945bc48 100644 --- a/src/libmongoc/tests/test-mongoc-max-staleness.c +++ b/src/libmongoc/tests/test-mongoc-max-staleness.c @@ -117,7 +117,7 @@ test_mongos_max_staleness_read_pref (void) /* count command with mode "secondary", no MONGOC_URI_MAXSTALENESSSECONDS. */ prefs = mongoc_read_prefs_new (MONGOC_READ_SECONDARY); mongoc_collection_set_read_prefs (collection, prefs); - future = future_collection_count (collection, MONGOC_QUERY_NONE, NULL, 0, 0, NULL, &error); + future = future_collection_estimated_document_count (collection, NULL, NULL, NULL, &error); request = mock_server_receives_msg (server, MONGOC_MSG_NONE, tmp_bson ("{'$db': 'db'," @@ -137,7 +137,7 @@ test_mongos_max_staleness_read_pref (void) mongoc_collection_set_read_prefs (collection, prefs); mongoc_collection_set_read_prefs (collection, prefs); - future = future_collection_count (collection, MONGOC_QUERY_NONE, NULL, 0, 0, NULL, &error); + future = future_collection_estimated_document_count (collection, NULL, NULL, NULL, &error); request = mock_server_receives_msg (server, MONGOC_MSG_NONE, tmp_bson ("{'$db': 'db'," @@ -157,7 +157,7 @@ test_mongos_max_staleness_read_pref (void) mongoc_read_prefs_set_max_staleness_seconds (prefs, MONGOC_NO_MAX_STALENESS); mongoc_collection_set_read_prefs (collection, prefs); - future = future_collection_count (collection, MONGOC_QUERY_NONE, NULL, 0, 0, NULL, &error); + future = future_collection_estimated_document_count (collection, NULL, NULL, NULL, &error); request = mock_server_receives_msg ( server, MONGOC_MSG_NONE, tmp_bson ("{'$db': 'db', '$readPreference': {'mode': 'secondaryPreferred'}}")); @@ -172,7 +172,7 @@ test_mongos_max_staleness_read_pref (void) mongoc_read_prefs_set_max_staleness_seconds (prefs, 1); mongoc_collection_set_read_prefs (collection, prefs); - future = future_collection_count (collection, MONGOC_QUERY_NONE, NULL, 0, 0, NULL, &error); + future = future_collection_estimated_document_count (collection, NULL, NULL, NULL, &error); request = mock_server_receives_msg (server, MONGOC_MSG_NONE, tmp_bson ("{'$db': 'db'," diff --git a/src/libmongoc/tests/test-mongoc-opts.c b/src/libmongoc/tests/test-mongoc-opts.c index 5df7c10a60..2c078ca138 100644 --- a/src/libmongoc/tests/test-mongoc-opts.c +++ b/src/libmongoc/tests/test-mongoc-opts.c @@ -424,15 +424,6 @@ collection_watch (func_ctx_t *ctx, bson_t *cmd) } -static future_t * -count (func_ctx_t *ctx, bson_t *cmd) -{ - BSON_APPEND_UTF8 (cmd, "count", "collection"); - return future_collection_count_with_opts ( - ctx->collection, MONGOC_QUERY_NONE, NULL, 0, 0, ctx->opts, ctx->prefs, &ctx->error); -} - - static future_t * count_documents (func_ctx_t *ctx, bson_t *cmd) { @@ -855,8 +846,6 @@ static opt_inheritance_test_t gInheritanceTests[] = { OPT_TEST (COLL, collection_read_write_cmd, WRITE_CONCERN), OPT_TEST (COLL, collection_watch, READ_CONCERN), OPT_TEST (COLL, collection_write_cmd, WRITE_CONCERN), - OPT_TEST (COLL, count, READ_CONCERN), - OPT_TEST (COLL, count, READ_PREFS), OPT_TEST (COLL, count_documents, READ_CONCERN), OPT_TEST (COLL, count_documents, READ_PREFS), // OPT_TEST (COLL, create_index, WRITE_CONCERN), Known issue: CDRIVER-5945 diff --git a/src/libmongoc/tests/test-mongoc-read-concern.c b/src/libmongoc/tests/test-mongoc-read-concern.c index 775fd9f1e2..fc121bb578 100644 --- a/src/libmongoc/tests/test-mongoc-read-concern.c +++ b/src/libmongoc/tests/test-mongoc-read-concern.c @@ -164,18 +164,6 @@ _test_read_concern_wire_version (bool explicit) future_destroy (future); - /* - * count - */ - future = - future_collection_count_with_opts (collection, MONGOC_QUERY_NONE, tmp_bson ("{}"), 0, 0, &opts, NULL, &error); - request = - mock_server_receives_msg (server, MONGOC_MSG_NONE, tmp_bson ("{'$db': 'db', 'readConcern': {'level': 'foo'}}")); - reply_to_request_simple (request, "{'ok': 1, 'n': 1}"); - request_destroy (request); - ASSERT_CMPINT64 (future_get_int64_t (future), ==, (int64_t) 1); - - future_destroy (future); mongoc_cursor_destroy (cursor); mongoc_collection_destroy (collection); mongoc_client_destroy (client);