christkv/node-mongodb-native — pull request #532 by pgebheim (2012-03-08 05:35:13+00:00)
Title: GridStore.seek fails to change chunks and call callback when in read mode

The current logic tests to see if our seek moves the position between chunks, if this is the case, it first saves the current chunk if in write mode, and then loads the next necessary chunk. However, if the file is opened in read mode, the logic is missing, so the callback is never called.

I'm patching this by pulling the chunk loading into a function which gets called either from within the callback to the chunk save, or the else condition.