Skip to content

Commit

Permalink
Fix aggregate for aiomongo (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
twd2 authored and breezewish committed Aug 24, 2017
1 parent c9f4534 commit cb0abe5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion vj4/job/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async def sync_usage():
bulk = coll.initialize_unordered_bulk_op()
execute = False
_logger.info('Counting')
async for adoc in db.coll('document').aggregate(pipeline):
async for adoc in await db.coll('document').aggregate(pipeline):
bulk.find({'domain_id': userfile.STORE_DOMAIN_ID,
'uid': adoc['_id']}) \
.update_one({'$set': {'usage_userfile': adoc['usage_userfile']}})
Expand Down
12 changes: 6 additions & 6 deletions vj4/job/num.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def discussion(domain_id: str):
bulk = coll.initialize_unordered_bulk_op()
execute = False
_logger.info('Counting')
async for adoc in db.coll('document').aggregate(pipeline):
async for adoc in await db.coll('document').aggregate(pipeline):
bulk.find({'domain_id': domain_id,
'doc_type': document.TYPE_DISCUSSION,
'doc_id': adoc['_id']}) \
Expand Down Expand Up @@ -64,7 +64,7 @@ async def contest(domain_id: str):
bulk = coll.initialize_unordered_bulk_op()
execute = False
_logger.info('Counting')
async for adoc in db.coll('document.status').aggregate(pipeline):
async for adoc in await db.coll('document.status').aggregate(pipeline):
bulk.find({'domain_id': domain_id,
'doc_type': document.TYPE_CONTEST,
'doc_id': adoc['_id']}) \
Expand Down Expand Up @@ -95,7 +95,7 @@ async def training(domain_id: str):
bulk = coll.initialize_unordered_bulk_op()
execute = False
_logger.info('Counting')
async for adoc in db.coll('document.status').aggregate(pipeline):
async for adoc in await db.coll('document.status').aggregate(pipeline):
bulk.find({'domain_id': domain_id,
'doc_type': document.TYPE_TRAINING,
'doc_id': adoc['_id']}) \
Expand Down Expand Up @@ -126,7 +126,7 @@ async def problem(domain_id: str):
user_coll = user_coll.initialize_unordered_bulk_op()
execute = False
_logger.info('Counting')
async for adoc in db.coll('document').aggregate(pipeline):
async for adoc in await db.coll('document').aggregate(pipeline):
user_coll.find({'domain_id': domain_id,
'uid': adoc['_id']}) \
.upsert().update_one({'$set': {'num_problems': adoc['num_problems']}})
Expand Down Expand Up @@ -156,7 +156,7 @@ async def problem_solution(domain_id: str):
bulk = coll.initialize_unordered_bulk_op()
execute = False
_logger.info('Counting')
async for adoc in db.coll('document.status').aggregate(pipeline):
async for adoc in await db.coll('document.status').aggregate(pipeline):
bulk.find({'domain_id': domain_id,
'doc_type': document.TYPE_PROBLEM_SOLUTION,
'doc_id': adoc['_id']}) \
Expand Down Expand Up @@ -184,7 +184,7 @@ async def problem_solution(domain_id: str):
user_bulk = user_coll.initialize_unordered_bulk_op()
execute = False
_logger.info('Counting')
async for adoc in db.coll('document').aggregate(pipeline):
async for adoc in await db.coll('document').aggregate(pipeline):
user_bulk.find({'domain_id': domain_id,
'uid': adoc['_id']}) \
.upsert().update_one({'$set': {'num_liked': adoc['num_liked']}})
Expand Down

0 comments on commit cb0abe5

Please sign in to comment.