Updated to latest mongoose code in agreement with author (nw)