-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 2.0.27
-
Component/s: None
-
Labels:
-
Empty show more show less
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');