mongofill/mongofill — pull request #50 by mmucklo (2014-06-05 23:05:32+00:00)
Title: Fix #48 - catch case where count is 0

We were running into this issue and noticed that our foreach loops were causing extra "null" values to get inserted into our data structures.

This patch seems to fix the problem - basically do most of a "current()" call when $currKey is 0 just to make sure that it's not a count == 0 result.

If it's a count == 0 result, then valid() has to return false to make sure the iterator wont run.