As mentioned in official docs here for transactions, Sessions & Transactions :: Spring Data MongoDB.
MongoDB does not support collection operations, such as collection creation, within a transaction.
MongoDB count
operates upon collection statistics which may not reflect the actual situation within a transaction.
I am using spring reactive programming, JPA in my application, how can I achieve both transaction capabilities ensuring count, create works as expected without using any new template