Fix/direct mongodb writer

| Q                    | A
| -------------------- | ---
| Bug fix?             | Yes
| New feature?         | No
| BC breaks?           | Yes
| CI currently passes? | Yes
| Tests pass?          | Yes
| Scenarios pass?      | Yes
| Checkstyle issues?*  | No
| PMD issues?**        | No
| Changelog updated?   | Yes
| Fixed tickets        |
| Doc PR               |

Fixes heavy memory consumption for the direct mongo import, where cached were not flushed
I don't understand why you created this class as parameter because it is not on this PR. The class already exists but is not used?