Dave Brondsema - 2016-02-12

Little mongo script to report server-side on who's subscribed to a tool:

db.mailbox.find({project_id: pid, app_config_id: ac_id}).forEach(function(m){
    user = db.user.findOne(m.user_id);
    username = user ? user.username : '<no user>';
    print(username, m.artifact_title, m.artifact_url);
});

And to see everything a user is subscribed to:

db.mailbox.find({user_id: uid}).forEach(function(m){
    artifact_url = '';
    if (m.artifact_url) {
        artifact_url = m.artifact_url;
    } else {
        p = db.project.findOne({_id: m.project_id});
        if (p) {
            ac = db.getSiblingDB('project-data').config.findOne({_id: m.app_config_id});
            if (ac) {
                artifact_url = p.shortname + '/' + ac.options.mount_point + '/';
            }
        }
    }
    print(m._id, artifact_url);
});