MONGOC_GRIDFS..._UPLOAD_STREAM(3)
π MONGOC_GRIDFS..._UPLOAD_STREAM(3) π
okay so bestie, this one lives in libmongoc (that's the C driver for MongoDB, mwah) and it's the function page for mongoc_gridfs_bucket_open_upload_stream. yes the title is lowkey truncated with those dots, that's just how the man page wears its name, don't come for her π
πΈ SYNOPSIS πΈ
mongoc_stream_t *
mongoc_gridfs_bucket_open_upload_stream (mongoc_gridfs_bucket_t *bucket,
const char *filename,
const bson_t *opts,
bson_value_t *file_id,
bson_error_t *error);
like, that's the whole signature, no cap β¨
π PARAMETERS π
bucketβ amongoc_gridfs_bucket_t. the main character of this whole operation π«Άfilenameβ the name of the file you're creating. literally what it'll be called.optsβ abson_torNULL. optional vibes only.file_idβ abson_value_tthat receives the generated id of the file, orNULLif you can't even be bothered πerrorβ abson_error_tto receive any error, orNULL. your little error catcher π
opts may be NULL or a BSON document with additional command options:
chunkSizeBytesβ an int32 chunk size to use for this file. Overrides thechunkSizeBytesset onbucket. so like, it takes priority, periodt πmetadataβ abson_trepresenting metadata to include with the file. the extra lore β¨
π¦ DESCRIPTION π¦
Opens a stream for writing to a new file in GridFS. That's the whole plot π¬
The file id is generated automatically β the universe picks it for you, slay π«
To specify an explicit file id, use mongoc_gridfs_bucket_open_upload_stream_with_id(). iykyk, different function, different page.
β RETURNS β
A mongoc_stream_t that can be written to, or NULL on failure. so like, vibe check the return value, bestie β NULL means it did not eat π
Errors on this stream can be retrieved with mongoc_gridfs_bucket_stream_error(). go get your diagnostics, they're right there.
After calling mongoc_stream_close() the file is completely written in GridFS. that's the moment. the final girl moment. π
fr fr though: the file isn't fully written until you hit mongoc_stream_close(), so don't go celebrating early π₯
π SEE ALSO:
mongoc_gridfs_bucket_open_upload_stream_with_id()mongoc_gridfs_bucket_stream_error()
π AUTHOR π
MongoDB, Inc β the icons who made this β¨
π COPYRIGHT π
2009-present, MongoDB, Inc. all theirs, we're just reading it π
and that's the tea π β this page is from libmongoc version 2.5.6, dated Oct 09, 2026. screenshot it, bookmark it, tell your friends, mwah ππ
π¦ where this page comes from
- epel 10: mongo-c-driver-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms