mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Updated mongodb queries to work with new transaction model.
This commit is contained in:
parent
8926178e52
commit
c6ea345d86
@ -130,12 +130,12 @@ def get_asset_by_id(conn, asset_id):
|
|||||||
|
|
||||||
|
|
||||||
@register_query(MongoDBConnection)
|
@register_query(MongoDBConnection)
|
||||||
def get_spent(conn, transaction_id, condition_id):
|
def get_spent(conn, transaction_id, output):
|
||||||
cursor = conn.db['bigchain'].aggregate([
|
cursor = conn.db['bigchain'].aggregate([
|
||||||
{'$unwind': '$block.transactions'},
|
{'$unwind': '$block.transactions'},
|
||||||
{'$match': {
|
{'$match': {
|
||||||
'block.transactions.fulfillments.input.txid': transaction_id,
|
'block.transactions.inputs.fulfills.txid': transaction_id,
|
||||||
'block.transactions.fulfillments.input.cid': condition_id
|
'block.transactions.inputs.fulfills.output': output
|
||||||
}}
|
}}
|
||||||
])
|
])
|
||||||
# we need to access some nested fields before returning so lets use a
|
# we need to access some nested fields before returning so lets use a
|
||||||
@ -148,7 +148,7 @@ def get_owned_ids(conn, owner):
|
|||||||
cursor = conn.db['bigchain'].aggregate([
|
cursor = conn.db['bigchain'].aggregate([
|
||||||
{'$unwind': '$block.transactions'},
|
{'$unwind': '$block.transactions'},
|
||||||
{'$match': {
|
{'$match': {
|
||||||
'block.transactions.conditions.owners_after': {
|
'block.transactions.outputs.public_keys': {
|
||||||
'$elemMatch': {'$eq': owner}
|
'$elemMatch': {'$eq': owner}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user