Shows both methods. A diode should be placed across the motor to absorb any voltage spike when the motor is turned off.
It sounds like the motor is quite small so any bipolar transistor like a bc547 would work in that method. I prefer to use Mosfets as good devices will give very low voltage drop when turned on, but you need to use ones with low gate threshold so they turn on with the 3.3V from a GPIO.