mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Change get_election to use find_one.
This commit is contained in:
parent
b8113f3e7a
commit
8211fa916e
@ -322,14 +322,12 @@ def get_validator_set(conn, height=None):
|
|||||||
def get_election(conn, election_id):
|
def get_election(conn, election_id):
|
||||||
query = {'election_id': election_id}
|
query = {'election_id': election_id}
|
||||||
|
|
||||||
cursor = conn.run(
|
return conn.run(
|
||||||
conn.collection('elections')
|
conn.collection('elections')
|
||||||
.find(query, projection={'_id': False})
|
.find_one(query, projection={'_id': False},
|
||||||
.sort([('height', DESCENDING)])
|
sort=[('height', DESCENDING)])
|
||||||
)
|
)
|
||||||
|
|
||||||
return next(cursor, None)
|
|
||||||
|
|
||||||
|
|
||||||
@register_query(LocalMongoDBConnection)
|
@register_query(LocalMongoDBConnection)
|
||||||
def get_asset_tokens_for_public_key(conn, asset_id, public_key):
|
def get_asset_tokens_for_public_key(conn, asset_id, public_key):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user