LearnBoost/mongoose — pull request #1055 by daveh957 (2012-08-15 16:20:43+00:00)
Title: Populate can bail out too early if empty array in the field being populated

Populate could bail out too early if the first document retrieved from the parent model contained an empty array in the field used for populating the child model. The _populate method will invoke the next function immediately in this event rather than being delayed by a database read causing the loop to end immediately. In order to fix this, I wrapped the call to _populate in "process.nextTick()".