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