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){
    url = '';
    if (m.artifact_url) {
        url = m.artifact_url;
    } else {
        p = db.project.findOne({_id: m.project_id});
        if (p) {
            url = p.shortname + '/';
            ac = db.getSiblingDB('project-data').config.findOne({_id: m.app_config_id});
            if (ac) {
                 url += ac.options.mount_point + '/';
            } else {
                 url += '  <deleted tool ' + m.app_config_id + '>';
             }
        }
    }
    print(m._id, url);
});
 

Last edit: Dave Brondsema 2022-07-28