Closed blakyris closed 4 years ago
@blakyris how is this different from #2109?
I've done some test to be sure it was a bug and I would like to be more precise on the behavior and what is the bug exactly.
Would you be able to write a functional test in ODM like this one? This would greatly speed things up for us.
@blakyris In the future, don’t open a new report for the same issue. I previously asked you to create a reproducer because I could not reproduce the issue in tests, and you haven’t done so yet. Until you do, there’s nothing we can do here or in any other ticket you create.
Ok I will make some tests for you to reproduce the issue.
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.
Hi, @alcaeus I've actually stumbled on the same issue I believe.
Here's a scenario that triggers the issue every time :
With a freshly booted mongo instance run an uploadFile to the instance, the fs.chunks are correctly created but the fs.files entry is not.
Notes : In my case it was within a loop of 15 files being created by the fixture class but only the first file shows the issue and only if the mongodb instance is freshly booted. My mongo instance is in a docker container. If I simply run the fixtures a second time without rebooting the instance (completely from scratch, not just restart) everything works fine.
Bug Report
Symfony version : 4.3 ODM Version : latest MongoDB : latest OS : WIndows 10 or Linux PHP : 7.2 / 7.3 PHP MongoDB Driver : 1.6
Summary
I'm storing a music collection in a Symfony project using MongoDB GridFS. I always delete database to be sure everything OK in my test env. I'm using MongoDB latest on Windows and Ubuntu (both native, not VM nor Docker or WSL...). MongoDB is a local instance with no credentials or anything fancy.
Current behavior
My app takes an audio file, reads ID3 tags and build an array of all track metadata. Then I'm storing the file, get the id of the file and link it to a Track in the Track collection. So I'm not storing the Track metadata in the FIle, but I'm storing the File id in the Track metadata collection. (that's not the issue because I've tested it.)
How to reproduce
To conclude, by my tests, the issus is :
When I delete the DB, I upload a file using uploadFromFile() function. fs.chunks and fs.files will be created but only chunks are stored and you have nothing in fs.files.
So you can create a DB with both collections : fs.files and fs.chunks in your DB and the file will be stored with its ref and the chunks.