-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.4.34
-
Component/s: None
-
Empty show more show less
If a file is saved with the filename having been set to an ObjectId, the file can be opened at a later date, but the GridStore.exist method does not take this type of parameter into account. Since it only takes a parameter (fileIdObject), it only performs a couple simple checks on this parameter, if it's a string or a RegExp. This doesn't take into account the possibility of an ObjectId for the filename being passed.
I propose changing the parameter from a singular type of just "fileIdObject", which then tries to guess what it is that you are wanting to match, to a more verbose querying object. For example, if the parameter (fileIdObject or whatever) is an actual object, other than a RegExp, that this object is used as the actual querying parameters. If I pass something like
{ filename: ObjectId("1234567") }that this be used as the query in the collection.findOne call.