@dispatch(Broadcast, MongoQuery)
def post_compute(e, q, scope=None):
 columns = dict(((col, 1) for qry in q.query for col in qry.get('$project', [])))
 scope = {'$project': toolz.merge({'_id': 0}, dict(((col, 1) for col in columns)))}
 q = q.append(scope)
 dicts = get_result(q.coll.aggregate(list(q.query)))
 assert (len(columns) == 1)
 return list(pluck(first(columns.keys()), dicts))

@ dispatch ( Broadcast , MongoQuery ) def post_compute ( e , q , scope = None ) : columns = dict ( ( ( col , 1 ) for qry in q . query for col in qry . get ( '$project' , [ ] ) ) ) scope = { '$project' : toolz . merge ( { '_id' : 0 } , dict ( ( ( col , 1 ) for col in columns ) ) ) } q = q . append ( scope ) dicts = get_result ( q . coll . aggregate ( list ( q . query ) ) ) assert ( len ( columns ) == 1 ) return list ( pluck ( first ( columns . keys ( ) ) , dicts ) )
compute the result of a broadcast expression .