I want send a Mongo doc to users anytime it changes. Basically what I need is to listen for change events and then when a document is changed it gets passed it into a function that broadcasts to the correct people.
Can I listen for change events somehow? Is there a better DB to do this type of thing?
Thanks!
SERVER-124 may be implemented someday. In the meantime, you can hook into a replication process. Basically, you should do what legitimate replication clients do: tail the local.oplog
collection. It contains all data modifications, you filter them, pick only interesting and broadcast to clients.
See here: http://www.mongodb.org/display/DOCS/Replication+Internals
It's a planned feature. Vote for it here https://jira.mongodb.org/browse/SERVER-124
You might be interested in mongo-oplog, which implements this in NodeJS by exploiting MongoDB's replication system.