How can I upload a file content in memory?

Hi, every body:
I have read a file into a memory buffer, but I do not know how to upload this file by memory buffer. I only retrieve mongoc_stream_file_new() this function . But it is by file description。