In case anyone is wondering. I solved my own problem by using the following python code. Definitely not the best for performance or getting the most out of mongodb but it does work. I'd probably recommend updating the salt returner to use mongodb better given that querying is pretty limited within the shell.
import datetime
import pymongo
import json
import re
hosts = ["mongodbuat"]
# initialize failures and successes
failures = 0
successes = 0
for host in hosts:
conn = pymongo.Connection(host)
mdb = conn['salt']
collections = set(mdb.collection_names())
hosts = []
jids = []
# for every collection, identify whether it is a host or a job
for c in collections:
# if the collection is a host add it to the host array
if not (len(c) == 20 and int(c)):
hosts.append(c)
# otherwise add it to the job array
else:
jids.append(c)
for h in hosts:
# for every job in a host connect to that collection
# and search for the job id to see if it exists
# and what its return was so we can report on that info
for j in jids:
coll = conn['salt'][h]
# search for the json documents returned from mongodb
# if the jobid exists in that host
for doc in coll.find({j: {'$exists': True}, "fun": "state.sls"}, {"_id": 0}):
# if the jobid exists find the host name in a readable format
c = str(coll)
thishost = ''
match = re.search('(\w+)\.spottrading\.com',c)
if match:
thishost = match.group(1)
# search the document returned in the form of a dictionary for
# the states you want to report on
for jobid, states in doc.iteritems():
if re.search('\d+', jobid):
print '\njob id =', jobid
if isinstance(states, list):
print states
failures += 1
elif isinstance(states, dict):
for job, data in states.iteritems():
print '\tjob: {0}, result: {1}'.format(job, data[u'result'])
successes += 1
print "{0} successes, {1} failures".format(successes, failures)