Mongoose schema type detection fixed