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

GridStore id not optional

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.0.28
    • Affects Version/s: 2.0.27
    • Component/s: None
    • Labels:

      Creating a new GridStore instance, id and filename are listed as optional parameters.

      var grid = new GridStore(db, 'w');

      Produces
      {{TypeError: Cannot read property 'indexOf' of undefined
      at new GridStore (.../node_modules/mongodb/lib/gridfs/grid_store.js:107:13)}}

      It looks like, after it checks that id is not an ObjectID and that filename is undefined, it never assigns mode = id; to accommodate the id parameter being optional.

      I'm able to sidestep the issue by including an arbitrary placeholder for id such as var grid = new GridStore(db, null, 'w'); or var grid = new GridStore(db, 'anything thats not an objectID', 'w');

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            almandot Almandot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: