refactorisation : all write on mongo come from one function