[CDRIVER-719] Provide access to _id when creating GridFS file Created: 23/Jun/15  Updated: 11/Sep/15  Resolved: 23/Jun/15

Status: Closed
Project: C Driver
Component/s: GridFS, libmongoc
Affects Version/s: None
Fix Version/s: 1.2-beta0

Type: New Feature Priority: Major - P3
Reporter: Marius Soutier Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

A newly created mongoc_gridfs_file_t apparently doesn't have access to its chunks, so I need to refetch the file to return a "complete" mongoc_gridfs_file_t. This is the same behavior as with the previous C driver, only that the previous driver gave you access to the ObjectId which would allow you to refetch the file immediately. Fetching by name is obviously ambiguous.

So please either add a function that gives you access to a GridFS file's ObjectId, or assign the chunks to the file immediately after uploading them.



 Comments   
Comment by A. Jesse Jiryu Davis [ 24/Jun/15 ]

No, actually, the version policy is not to expand the API in patch releases, so I can't release a new API like mongoc_gridfs_file_get_id until 1.2.0. I plan to release it in the next couple months.

Comment by Marius Soutier [ 24/Jun/15 ]

Cool, thanks. Any chance of backporting this to 1.1.x?

Comment by A. Jesse Jiryu Davis [ 23/Jun/15 ]

This has been implemented, in fact, and will be released in version 1.2. this quarter. Example use:

https://github.com/mongodb/mongo-c-driver/blob/1.2.0-dev/tests/test-mongoc-gridfs.c#L215-215

Declaration:

https://github.com/mongodb/mongo-c-driver/blob/1.2.0-dev/src/mongoc/mongoc-gridfs-file.h#L70

Generated at Wed Feb 07 21:10:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.