Direct mongodb writer

| Q                    | A
| -------------------- | ---
| Bug fix?             | No
| New feature?         | Yes
| BC breaks?           | No
| CI currently passes? | Yes
| Tests pass?          | Yes
| Scenarios pass?      | Yes
| Checkstyle issues?   | No
| Changelog updated?   | Yes
| Fixed tickets        | N.A.
| Doc PR               | N.A.
It is not better to count out of the loop?