code: def all(cls):
          
  
          # Start with raw queues we know exist from the config
          queues = {x: 0 for x in Queue.get_queues_config()}
  
          stats = list(context.connections.mongodb_jobs.mrq_jobs.aggregate([
              {"$match": {"status": "queued"}},
              {"$group": {"_id": "$queue", "jobs": {"$sum": 1}}}
          ]))
  
          queues.update({x["_id"]: x["jobs"] for x in stats})
  
          return queues
docs: List all queues in MongoDB via aggregation, with their queued jobs counts. Might be slow.