moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 513 forks source link

Mongo #740

Open jcald1 opened 6 years ago

jcald1 commented 6 years ago

I'm trying to configure Mongo with Mosca. The following is my configuration. I noticed that occasionally the messages are stored in Mongo in the "mqtt" database, and other times, when I removed the database, it wasn't recreated, but the Mosca publish and subscribe functionality works fine. It's not clear me the difference between the backend and persistence configuration and why sometimes the db isn't being used at all.

var moscaConfig = { "port": 1883, "backend": { "type": "mongo",
"url": "mongodb://10.219.37.253:27017/mqtt?auto_reconnect", "pubsubCollection": "mypubsub", "mongo": {} }, "persistence": { "factory": "mosca.persistence.Mongo", "url": "mongodb://10.219.37.253:27017/mqtt" }