Skip to content

Commit 64ecb9f

Browse files
authored
remove deprecated GridFS API (#1961)
* remove `mongoc_gridfs_find` * remove `mongoc_gridfs_find_one`
1 parent 1b6b6d4 commit 64ecb9f

11 files changed

+17
-195
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ Unreleased (2.0.0)
9797
* Deprecated API for `mongoc_database_t` is removed:
9898
* `mongoc_database_find_collections` is removed. Use `mongoc_database_find_collections_with_opts` instead.
9999
* `mongoc_database_get_collection_names` is removed. Use `mongoc_database_get_collection_names_with_opts` instead.
100+
* Deprecated GridFS API has been removed:
101+
* `mongoc_gridfs_find` is removed. Use `mongoc_gridfs_find_with_opts` instead.
102+
* `mongoc_gridfs_find_one` is removed. Use `mongoc_gridfs_find_one_with_opts` instead.
100103

101104
### Forwarding headers (`#include <bson.h>` and `#include <mongoc.h>`)
102105

build/generate-future-functions.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,6 @@
399399
param("size_t", "min_bytes"),
400400
param("uint32_t", "timeout_msec")]),
401401

402-
future_function("mongoc_gridfs_file_ptr",
403-
"mongoc_gridfs_find_one",
404-
[param("mongoc_gridfs_ptr", "gridfs"),
405-
param("const_bson_ptr", "query"),
406-
param("bson_error_ptr", "error")]),
407-
408402
future_function("bool",
409403
"mongoc_gridfs_file_remove",
410404
[param("mongoc_gridfs_file_ptr", "file"),

src/libmongoc/doc/mongoc_gridfs_file_list_t.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Example
2525
mongoc_gridfs_file_list_t *list;
2626
mongoc_gridfs_file_t *file;
2727
28-
list = mongoc_gridfs_find (gridfs, query);
28+
list = mongoc_gridfs_find_with_opts (gridfs, query, NULL);
2929
3030
while ((file = mongoc_gridfs_file_list_next (list))) {
3131
do_something (file);

src/libmongoc/doc/mongoc_gridfs_find.rst

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/libmongoc/doc/mongoc_gridfs_find_one.rst

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/libmongoc/doc/mongoc_gridfs_t.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ Example
6565
mongoc_gridfs_create_file_from_stream
6666
mongoc_gridfs_destroy
6767
mongoc_gridfs_drop
68-
mongoc_gridfs_find
69-
mongoc_gridfs_find_one
7068
mongoc_gridfs_find_one_by_filename
7169
mongoc_gridfs_find_one_with_opts
7270
mongoc_gridfs_find_with_opts

src/libmongoc/src/mongoc/mongoc-gridfs.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -174,37 +174,6 @@ mongoc_gridfs_destroy (mongoc_gridfs_t *gridfs)
174174
}
175175

176176

177-
/** find all matching gridfs files */
178-
mongoc_gridfs_file_list_t *
179-
mongoc_gridfs_find (mongoc_gridfs_t *gridfs, const bson_t *query)
180-
{
181-
return _mongoc_gridfs_file_list_new (gridfs, query, 0);
182-
}
183-
184-
185-
/** find a single gridfs file */
186-
mongoc_gridfs_file_t *
187-
mongoc_gridfs_find_one (mongoc_gridfs_t *gridfs, const bson_t *query, bson_error_t *error)
188-
{
189-
mongoc_gridfs_file_list_t *list;
190-
mongoc_gridfs_file_t *file;
191-
192-
ENTRY;
193-
194-
list = _mongoc_gridfs_file_list_new (gridfs, query, 1);
195-
196-
file = mongoc_gridfs_file_list_next (list);
197-
if (!mongoc_gridfs_file_list_error (list, error) && error) {
198-
/* no error, but an error out-pointer was provided - clear it */
199-
memset (error, 0, sizeof (*error));
200-
}
201-
202-
mongoc_gridfs_file_list_destroy (list);
203-
204-
RETURN (file);
205-
}
206-
207-
208177
/** find all matching gridfs files */
209178
mongoc_gridfs_file_list_t *
210179
mongoc_gridfs_find_with_opts (mongoc_gridfs_t *gridfs, const bson_t *filter, const bson_t *opts)

src/libmongoc/src/mongoc/mongoc-gridfs.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,6 @@ mongoc_gridfs_create_file_from_stream (mongoc_gridfs_t *gridfs, mongoc_stream_t
4040
MONGOC_EXPORT (mongoc_gridfs_file_t *)
4141
mongoc_gridfs_create_file (mongoc_gridfs_t *gridfs, mongoc_gridfs_file_opt_t *opt) BSON_GNUC_WARN_UNUSED_RESULT;
4242

43-
BSON_DEPRECATED_FOR (mongoc_gridfs_find_with_opts)
44-
MONGOC_EXPORT (mongoc_gridfs_file_list_t *) mongoc_gridfs_find (mongoc_gridfs_t *gridfs, const bson_t *query)
45-
BSON_GNUC_WARN_UNUSED_RESULT;
46-
47-
BSON_DEPRECATED_FOR (mongoc_gridfs_find_one_with_opts)
48-
MONGOC_EXPORT (mongoc_gridfs_file_t *)
49-
mongoc_gridfs_find_one (mongoc_gridfs_t *gridfs, const bson_t *query, bson_error_t *error)
50-
BSON_GNUC_WARN_UNUSED_RESULT;
51-
5243
MONGOC_EXPORT (mongoc_gridfs_file_list_t *)
5344
mongoc_gridfs_find_with_opts (mongoc_gridfs_t *gridfs, const bson_t *filter, const bson_t *opts)
5445
BSON_GNUC_WARN_UNUSED_RESULT;

src/libmongoc/tests/mock_server/future-functions.c

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -851,27 +851,6 @@ BSON_THREAD_FUN (background_mongoc_gridfs_file_readv, data)
851851
BSON_THREAD_RETURN;
852852
}
853853

854-
static
855-
BSON_THREAD_FUN (background_mongoc_gridfs_find_one, data)
856-
{
857-
future_t *future = (future_t *) data;
858-
future_value_t return_value;
859-
860-
return_value.type = future_value_mongoc_gridfs_file_ptr_type;
861-
862-
future_value_set_mongoc_gridfs_file_ptr (
863-
&return_value,
864-
mongoc_gridfs_find_one (
865-
future_value_get_mongoc_gridfs_ptr (future_get_param (future, 0)),
866-
future_value_get_const_bson_ptr (future_get_param (future, 1)),
867-
future_value_get_bson_error_ptr (future_get_param (future, 2))
868-
));
869-
870-
future_resolve (future, return_value);
871-
872-
BSON_THREAD_RETURN;
873-
}
874-
875854
static
876855
BSON_THREAD_FUN (background_mongoc_gridfs_file_remove, data)
877856
{
@@ -2304,28 +2283,6 @@ future_gridfs_file_readv (
23042283
return future;
23052284
}
23062285

2307-
future_t *
2308-
future_gridfs_find_one (
2309-
mongoc_gridfs_ptr gridfs,
2310-
const_bson_ptr query,
2311-
bson_error_ptr error)
2312-
{
2313-
future_t *future = future_new (future_value_mongoc_gridfs_file_ptr_type,
2314-
3);
2315-
2316-
future_value_set_mongoc_gridfs_ptr (
2317-
future_get_param (future, 0), gridfs);
2318-
2319-
future_value_set_const_bson_ptr (
2320-
future_get_param (future, 1), query);
2321-
2322-
future_value_set_bson_error_ptr (
2323-
future_get_param (future, 2), error);
2324-
2325-
future_start (future, background_mongoc_gridfs_find_one);
2326-
return future;
2327-
}
2328-
23292286
future_t *
23302287
future_gridfs_file_remove (
23312288
mongoc_gridfs_file_ptr file,

src/libmongoc/tests/mock_server/future-functions.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -408,15 +408,6 @@ future_gridfs_file_readv (
408408
);
409409

410410

411-
future_t *
412-
future_gridfs_find_one (
413-
414-
mongoc_gridfs_ptr gridfs,
415-
const_bson_ptr query,
416-
bson_error_ptr error
417-
);
418-
419-
420411
future_t *
421412
future_gridfs_file_remove (
422413

0 commit comments

Comments
 (0)