MONGOC_GRIDFS...STREAM_WITH_ID(3)

✨ MONGOC_GRIDFS...STREAM_WITH_ID(3) ✨

okay bestie, welcome to the libmongoc manual page for mongoc_gridfs...stream_with_id β€” yes that's the truncated title, the real function is mongoc_gridfs_bucket_open_upload_stream_with_id and it's lowkey iconic πŸŽ€


🌸 SYNOPSIS 🌸

mongoc_stream_t *
mongoc_gridfs_bucket_open_upload_stream_with_id (mongoc_gridfs_bucket_t *bucket,
                                                 const bson_value_t *file_id,
                                                 const char *filename,
                                                 const bson_t *opts,
                                                 bson_error_t *error);

that's the whole vibe check right there, no cap ✨


πŸ’… PARAMETERS πŸ’…

  • bucket β€” A mongoc_gridfs_bucket_t. the main character of this whole operation 🫢
  • file_id β€” A bson_value_t specifying the id of the created file. you pick the id, you're in charge, periodt πŸ‘‘
  • filename β€” The name of the file to create. name it something cute fr fr πŸ¦‹
  • opts β€” A bson_t or NULL. optional-ish, we love a flexible queen πŸ’œ
  • error β€” A bson_error_t to receive any error or NULL. catch those L's if you want, or don't πŸ™ˆ

opts may be NULL or a BSON document with additional command options:

  • chunkSizeBytes β€” An int32 chunk size to use for this file. Overrides the chunkSizeBytes set on bucket. so like, it overrides the bucket setting, it said what it said πŸ’€
  • metadata β€” A bson_t representing metadata to include with the file. little extra lore for your file, we love to see it 🌈

πŸ¦‹ DESCRIPTION πŸ¦‹

Opens a stream for writing to a new file in GridFS for a specified file id. literally opening the stream, handing it a file id, and being like "go off" πŸ’«

not me about to say something important: to have libmongoc generate an id for you instead, use mongoc_gridfs_bucket_open_upload_stream(). let the library pick, it's got range πŸŽ€

⭐ RETURNS ⭐

A mongoc_stream_t that can be written to or NULL on failure. Errors on this stream can be retrieved with mongoc_gridfs_bucket_stream_error(). πŸ“

After calling mongoc_stream_close() the file is completely written in GridFS. like, fully done, ate and left no crumbs πŸ”₯

πŸ‘€ SEE ALSO: πŸ‘€

  • mongoc_gridfs_bucket_open_upload_stream()
  • mongoc_gridfs_bucket_stream_error()

🌟 AUTHOR 🌟

MongoDB, Inc β€” the icons themselves πŸ‘‘


2009-present, MongoDB, Inc.


and that's the whole page bestie, ily, go write some files πŸ’…βœ¨

version 2.5.6 🌸 dated Oct 09, 2026 πŸŽ€ β€” mwah, see u in the next manpage 🫢

πŸ“¦ where this page comes from