1MONGOC_GRIDFS_BUCKET_NEW(3) libmongoc MONGOC_GRIDFS_BUCKET_NEW(3)
2
3
4
6 mongoc_gridfs_bucket_t *
7 mongoc_gridfs_bucket_new (mongoc_database_t *db,
8 const bson_t *opts,
9 const mongoc_read_prefs_t *read_prefs,
10 bson_error_t* error) BSON_GNUC_WARN_UNUSED_RESULT;
11
13 • db: A mongoc_database_t.
14
15 • opts: A bson_t or NULL
16
17 • read_prefs: A mongoc_read_prefs_t used for read operations or NULL to
18 inherit read preferences from db.
19
20 • error: A bson_error_t or NULL.
21
22 opts may be NULL or a BSON document with additional command options:
23
24 • bucketName: A UTF-8 string used as the prefix to the GridFS "chunks"
25 and "files" collections. Defaults to "fs". The bucket name, together
26 with the database and suffix collections must not exceed 120 charac‐
27 ters. See the manual for the max namespace length.
28
29 • chunkSizeBytes: An int32 representing the chunk size. Defaults to
30 255KB.
31
32 • writeConcern: Construct a mongoc_write_concern_t and use
33 mongoc_write_concern_append() to add the write concern to opts. See
34 the example code for mongoc_client_write_command_with_opts().
35
36 • readConcern: Construct a mongoc_read_concern_t and use
37 mongoc_read_concern_append() to add the read concern to opts. See the
38 example code for mongoc_client_read_command_with_opts(). Read concern
39 requires MongoDB 3.2 or later, otherwise an error is returned.
40
42 Creates a new mongoc_gridfs_bucket_t. Use this handle to perform GridFS
43 operations.
44
46 A newly allocated mongoc_gridfs_bucket_t that should be freed with
47 mongoc_gridfs_bucket_destroy() or NULL on failure.
48
50 MongoDB, Inc
51
53 2017-present, MongoDB, Inc
54
55
56
57
581.25.1 Nov 08, 2023 MONGOC_GRIDFS_BUCKET_NEW(3)