MONGOC_GRIDFS...AD_FROM_STREAM(3)
π MONGOC_GRIDFS_BUCKET_UPLOAD_FROM_STREAM(3) π
okay so bestie, welcome to libmongoc β yes that's the manual we're living in right now, and today's main character is mongoc_gridfs_bucket_upload_from_stream(). she uploads. she streams. she slays. let's get into it π«Ά
β¨ SYNOPSIS β¨
bool
mongoc_gridfs_bucket_upload_from_stream (mongoc_gridfs_bucket_t *bucket,
const char *filename,
mongoc_stream_t *source,
const bson_t *opts,
bson_value_t *file_id,
bson_error_t *error);
π PARAMETERS π
bucketβ amongoc_gridfs_bucket_t. the bucket in question. iconic.filenameβ the name of the file to create. name her, girl.sourceβ amongoc_stream_tused as the source of the data to upload. this is where the bytes come from, no cap.optsβ abson_torNULL. literally optional, like your third coffee.file_idβ abson_value_tto receive the generated id of the file, orNULL. she'll hand you the id if you give her somewhere to put it πΈerrorβ abson_error_tto receive any error, orNULL. give her a place to vent or she'll keep it inside π
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. yes, she overrides. she's that girl.metadataβ abson_trepresenting metadata to include with the file. receipts, basically. π
π¦ DESCRIPTION π¦
reads from the source stream and writes to a new file in GridFS. the file id is generated automatically β the way that she just does that? obsessed.
need a specific file id instead? use mongoc_gridfs_bucket_upload_from_stream_with_id() β that's her sister, also iconic.
she reads from the source stream using mongoc_stream_read() until the return value indicates end-of-file. that's it. that's the whole vibe check. β
important, bestie: the source stream is not closed after callingmongoc_gridfs_bucket_upload_from_stream(). you gotta callmongoc_stream_close()after. she's not gonna do it for you, she's not your mom π«Ά
π₯ RETURNS π₯
True if the operation succeeded. False otherwise β and in that case she sets error. fr fr.
π« SEE ALSO π«
mongoc_stream_file_new()andmongoc_stream_file_new_for_path()β these can be used to create a source stream from a file. like, if you needed a source stream from a file. iykyk π
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
okay that's the whole page!! she's giving documentation, she's giving library energy π this was libmongoc, version 2.5.6, dated ever so iconically as Oct 09, 2026 β go forth and upload from a stream, bestie, and don't forget to close that stream. periodt. π β¨
π¦ 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