Meteor sharing database with Go?


#1

Hello!
I want to build an IoT app which uses Arduino, Go and Meteor.js.
I would like the Go APIs to process payloads coming from the Arduino via MQTT. This data should then go into MongoDB, which is shared with a Meteor.js application that displays the gathered real time information.
Do you see any problem with this setup? Are there going to be any sync problems between the data being stored and what is displayed in the frontend?


#2

Sounds perfectly doable to me.


#3

Only caveat I’ve run into is that if you use collection hooks (before/after/etc) in your Meteor app, they won’t run for changes that come via the Go app (as they live inside the data layer of meteor’s app code).
If you need that behaviour on the Meteor side, you can use Mongo.Cursor#observeChanges and run hooks to modify the documents there


#4

You can pretty much do this easily. To achieve this, you need to add Redis Oplog by @diaconutheodor to the mix. Read the doc on Outside Mutation


#5

Have you looked at Emitter? Not sure if that helps your use case, but it might be ab option as well.