Best way to connect EMQX to MongoDB?


I have mounted EMQ X Broker and MongoDB on my local computer. I need to save messages from some topics in my database, now I’m using Node-Red but it fails sometimes.
I know that EMQ X has an add-on for MongoDB but I don’t know how to configure it, could you please help me with this.
Every 1 second I get 8 messages, in one hour I have 28800 messages, the main thing is that I don’t lose any of them.