In the example, the Document without the dependencies injected needs to know how to connect to the database; the one with the dependency injected just use what is passed to it.

The core idea of dependency injection is to allow objects to focus on the things that are important to them. In a way, the object injected with the dependencies is using interfaces instead of concrete implementations, so the injection of dependencies is useful to decoupling the different parts of the system, leveraging its understanding and making testing easier.