[CDRIVER-1976] mongoc_gridfs_file_set_id always return false, error: Cannot set file id after saving file. Created: 03/Jan/17  Updated: 03/May/17  Resolved: 04/Jan/17

Status: Closed
Project: C Driver
Component/s: GridFS
Affects Version/s: 1.5.1
Fix Version/s: None

Type: Bug Priority: Blocker - P1
Reporter: David Assignee: A. Jesse Jiryu Davis
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

windows , ubuntu



 Description   

HI,
I find a problem:
function: mongoc_gridfs_file_set_id always return false and output error: "Cannot set file id after saving file." when I call it before mongoc_gridfs_file_save.



 Comments   
Comment by A. Jesse Jiryu Davis [ 04/Jan/17 ]

Hi, I can't reproduce the problem you reported. In this test, we call mongoc_gridfs_file_set_id before mongoc_gridfs_file_save and it works as designed:

https://github.com/mongodb/mongo-c-driver/blob/34be38148c7c4529323f3c536cbe8f3ae05d61ea/tests/test-mongoc-gridfs.c#L1033

You can also build the example program "example-gridfs" from "example-gridfs.c" and run it:

# arguments are "destination filename" and "source filename"
./example-gridfs write README README.rst

The outcome is a file with _id of 1, as expected.

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