Skip to content

Commit 8726a85

Browse files
authored
CDRIVER-5942 remove deprecated count API (#1953)
* remove deprecated count helpers * restore NEWS of removals ** Was accidentally removed in 1b6b6d4
1 parent 09018b8 commit 8726a85

18 files changed

+26
-1008
lines changed

NEWS

+5
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ The BSON library has had similar name changes.
116116
* `mongoc_collection_insert_many`
117117
* `mongoc_bulkwrite_t`
118118
* `mongoc_bulk_operation_t`
119+
* `mongoc_bulk_operation_delete` is removed. Use `mongoc_bulk_operation_remove()` instead.
120+
* `mongoc_bulk_operation_delete_one` is removed. Use `mongoc_bulk_operation_remove_one` instead.
121+
* `mongoc_bulk_operation_get_hint` is removed. Use `mongoc_bulk_operation_get_server_id` instead.
122+
* `mongoc_bulk_operation_set_hint` is removed. Use `mongoc_bulk_operation_set_server_id` instead.
123+
* `mongoc_collection_count` and `mongoc_collection_count_with_opts` are removed. Use `mongoc_collection_count_documents` or `mongoc_collection_estimated_document_count` instead.
119124
* `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.
120125
* `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.
121126
* Deprecated API for `mongoc_database_t` is removed:

build/generate-future-functions.py

-21
Original file line numberDiff line numberDiff line change
@@ -215,27 +215,6 @@
215215
param("const_bson_ptr", "options"),
216216
param("const_mongoc_read_prefs_ptr", "read_prefs")]),
217217

218-
future_function("int64_t",
219-
"mongoc_collection_count",
220-
[param("mongoc_collection_ptr", "collection"),
221-
param("mongoc_query_flags_t", "flags"),
222-
param("const_bson_ptr", "query"),
223-
param("int64_t", "skip"),
224-
param("int64_t", "limit"),
225-
param("const_mongoc_read_prefs_ptr", "read_prefs"),
226-
param("bson_error_ptr", "error")]),
227-
228-
future_function("int64_t",
229-
"mongoc_collection_count_with_opts",
230-
[param("mongoc_collection_ptr", "collection"),
231-
param("mongoc_query_flags_t", "flags"),
232-
param("const_bson_ptr", "query"),
233-
param("int64_t", "skip"),
234-
param("int64_t", "limit"),
235-
param("const_bson_ptr", "opts"),
236-
param("const_mongoc_read_prefs_ptr", "read_prefs"),
237-
param("bson_error_ptr", "error")]),
238-
239218
future_function("bool",
240219
"mongoc_collection_create_indexes_with_opts",
241220
[param("mongoc_collection_ptr", "collection"),

src/libmongoc/doc/errors.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ To fix this flaw while preserving backward compatibility, the C Driver 1.4 intro
160160
| :symbol:`mongoc_database_command_with_opts`, and | | |
161161
| other command functions | | |
162162
+------------------------------------------------------+----------------------------------------+----------------------------------------+
163-
| :symbol:`mongoc_collection_count_with_opts` | ``MONGOC_ERROR_QUERY`` | ``MONGOC_ERROR_SERVER`` |
164-
| :symbol:`mongoc_client_get_database_names_with_opts`,| | |
163+
| :symbol:`mongoc_client_get_database_names_with_opts` | ``MONGOC_ERROR_QUERY`` | ``MONGOC_ERROR_SERVER`` |
165164
| and other command helper functions | | |
166165
+------------------------------------------------------+----------------------------------------+----------------------------------------+
167166
| :symbol:`mongoc_collection_insert_one` | ``MONGOC_ERROR_COMMAND`` | ``MONGOC_ERROR_SERVER`` |

src/libmongoc/doc/mongoc_collection_count.rst

-85
This file was deleted.

src/libmongoc/doc/mongoc_collection_count_documents.rst

-23
Original file line numberDiff line numberDiff line change
@@ -76,29 +76,6 @@ Example
7676
}
7777
}
7878
79-
.. _migrating-from-deprecated-count:
80-
81-
Migrating from deprecated count functions
82-
-----------------------------------------
83-
84-
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:
85-
86-
+-------------+-------------------------------------+
87-
| Operator | Replacement |
88-
+=============+=====================================+
89-
| $where | `$expr`_ |
90-
+-------------+-------------------------------------+
91-
| $near | `$geoWithin`_ with `$center`_ |
92-
+-------------+-------------------------------------+
93-
| $nearSphere | `$geoWithin`_ with `$centerSphere`_ |
94-
+-------------+-------------------------------------+
95-
96-
$expr requires MongoDB 3.6+
97-
98-
.. _$expr: https://www.mongodb.com/docs/manual/reference/operator/query/expr/
99-
.. _$geoWithin: https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/
100-
.. _$center: https://www.mongodb.com/docs/manual/reference/operator/query/center/#op._S_center
101-
.. _$centerSphere: https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/#op._S_centerSphere
10279
10380
.. seealso::
10481

src/libmongoc/doc/mongoc_collection_count_with_opts.rst

-139
This file was deleted.

src/libmongoc/doc/mongoc_collection_t.rst

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ Read preferences and write concerns are inherited from the parent client. They c
3232
mongoc_collection_copy
3333
mongoc_collection_count_documents
3434
mongoc_collection_estimated_document_count
35-
mongoc_collection_count
36-
mongoc_collection_count_with_opts
3735
mongoc_collection_create_bulk_operation_with_opts
3836
mongoc_collection_create_indexes_with_opts
3937
mongoc_collection_delete_many

0 commit comments

Comments
 (0)