Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-385

GridStore.exist does not take ObjectId for filename

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0.22
    • Affects Version/s: 1.4.34
    • Component/s: None

      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.

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            trickeyone Josh England
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: