mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
parent
b6c21ed819
commit
4f0ba65858
@ -153,14 +153,22 @@ def get_spent(conn, transaction_id, output):
|
|||||||
cursor = conn.run(
|
cursor = conn.run(
|
||||||
conn.collection('bigchain').aggregate([
|
conn.collection('bigchain').aggregate([
|
||||||
{'$match': {
|
{'$match': {
|
||||||
'block.transactions.inputs.fulfills.txid': transaction_id,
|
'block.transactions.inputs': {
|
||||||
'block.transactions.inputs.fulfills.output': output
|
'$elemMatch': {
|
||||||
|
'fulfills.txid': transaction_id,
|
||||||
|
'fulfills.output': output,
|
||||||
|
},
|
||||||
|
},
|
||||||
}},
|
}},
|
||||||
{'$unwind': '$block.transactions'},
|
{'$unwind': '$block.transactions'},
|
||||||
{'$match': {
|
{'$match': {
|
||||||
'block.transactions.inputs.fulfills.txid': transaction_id,
|
'block.transactions.inputs': {
|
||||||
'block.transactions.inputs.fulfills.output': output
|
'$elemMatch': {
|
||||||
}}
|
'fulfills.txid': transaction_id,
|
||||||
|
'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
|
||||||
# generator to avoid having to read all records on the cursor at this point
|
# generator to avoid having to read all records on the cursor at this point
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user