revision of mongo_formatter

rebased on the current master