Created
December 5, 2018 10:09
-
-
Save nnn-gif/ff5b12a26efda8f05fe8d841bd270c12 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db.createView('uncles', 'blocks', [ | |
| { $sort: { _id: -1 } }, | |
| { $unwind: { path: '$uncles', includeArrayIndex: "position" } }, | |
| { $project: { hash: 1, number: 1, timestamp: '$header.timestamp', index: 1, uncle: '$uncles' ,blockNumber:1} }, | |
| { | |
| $addFields: { | |
| 'uncle.timestamp': '$timestamp', | |
| 'uncle.index': '$index', | |
| 'uncle.blockNumber': '$index', | |
| 'uncle.position':'$position' | |
| } | |
| }, | |
| { | |
| $project: { | |
| parentHash: '$uncle.parentHash', | |
| blockNumber: '$uncle.blockNumber', | |
| position: '$uncle.position', | |
| sha3Uncles: '$uncle.sha3Uncles', | |
| hash: '$uncle.hash', | |
| timestamp: '$uncle.timestamp', | |
| nonce: '$uncle.nonce', | |
| miner: '$uncle.miner', | |
| rewards: '$uncle.rewards', | |
| difficulty: '$uncle.difficulty', | |
| totalDifficulty: '$uncle.totalDifficulty', | |
| stateRoot: '$uncle.stateRoot', | |
| transactionsRoot: '$uncle.transactionsRoot', | |
| receiptsRoot: '$uncle.receiptsRoot', | |
| logsBloom: '$uncle.logsBloom', | |
| gasLimit: '$uncle.gasLimit', | |
| gasUsed: '$uncle.gasUsed', | |
| mixHash: '$uncle.mixHash', | |
| extraData: '$uncle.extraData' | |
| } | |
| } | |
| ]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment