Getting to the bottom of the mongo query bug