Skip to content
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

CDRIVER-5942 remove deprecated count API #1953

Merged
merged 6 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,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:
Expand Down
21 changes: 0 additions & 21 deletions build/generate-future-functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
3 changes: 1 addition & 2 deletions src/libmongoc/doc/errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`` |
Expand Down
85 changes: 0 additions & 85 deletions src/libmongoc/doc/mongoc_collection_count.rst

This file was deleted.

23 changes: 0 additions & 23 deletions src/libmongoc/doc/mongoc_collection_count_documents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down
139 changes: 0 additions & 139 deletions src/libmongoc/doc/mongoc_collection_count_with_opts.rst

This file was deleted.

2 changes: 0 additions & 2 deletions src/libmongoc/doc/mongoc_collection_t.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading