mongodb/node-mongodb-native — pull request #1169 by vsivsi (2014-04-28 04:59:21+00:00)
Title: Rewriting a gridStore file by id should use a new filename if provided

In GridStore, if an exiting file is opened for write and a valid `_id` is provided, a provided `filename` parameter is not used as the filename for the newly written file, even though every other bit of metadata file data can be replaced, significantly including `contentType`.

It is unexpected and inconsistent behavior to create a file called `stuff.txt` with type `text/plain` and then be able to open it for rewriting as `stuff.html` with type `text/html` and have the new filename discarded, but the new content-type retained. This pull request fixes this bug by allowing the rewrite of the file to set a new filename to match the new content-type.

This commit also fixes an obvious `this`/`self` typo bug regarding filename in the same function.