(Not so) Minimal reproduction of an (possible) error happening within the Client side .remove()
operation of FileCollection
Meteor package
(refers to Issue #152 from the Meteor Atmosphere package vsivsi:file-collection)
To reproduce the error, just do the following steps:
- Clone this repository to your machine;
- Run the application with the command
meteor
, as normal; - Go to the browser, on http://localhost:3000/, and Add more than one Event with a Banner image;
- Choose any of the Events with a Banner image, and Edit it (Change or Remove the Banner);
EXPECTED: When Changing or Removing the Banner, the application should Remove the previous Banner from the FileCollection
(Images), and only this file.
RESULT: ALL the files from FileCollection
(Images) are Removed (it can be confirmed in the MongoDB shell, running meteor mongo
and looking at the images.files
Collection).
The lines where the .remove()
operation is executed are highlighted at lines 144 and 191 from the file client/components/eventsForm.js
UPDATE: The error was tracked down by @vsivsi as a problem with the combined use of the package
vsivsi:file-collection
and the packagedburles:collection-helpers
(classifying it as an undesired Feature Interaction problem - look here for more details about what Feature Interactions are). Basically, thedburles:collection-helpers
overwrite some basicMongo.Collection
methods when you assign a collection helper, and it breaks the.remove()
operation on theFileCollection
. See this Issues page for a more detailed explanation.
UPDATE: A temporary solution was uploaded in the problem_solved branch. It just doesn't assign any collection helper to the
FileCollection
anymore. The thing is, this problem can potentially be happening in ANY collection, as in the tests some operations from a regularMongo.Collection
returned wrong values when it was assigned a collection helper. In that case, the problem would be classified as a Feature Interaction between Meteor's baseMongo.Collection
instance and the packagedburles:collection-helpers
. This has yet to be confirmed.