Skip to content

Commit

Permalink
Add index on the rich list
Browse files Browse the repository at this point in the history
  • Loading branch information
sondreb committed Sep 6, 2020
1 parent 8ea25f3 commit 58c46b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blockcoreindexer",
"version": "0.1.7",
"version": "0.1.8",
"license": "MIT",
"author": {
"name": "Blockcore",
Expand Down
4 changes: 4 additions & 0 deletions src/Blockcore.Indexer/Storage/Mongo/MongoBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,16 @@ public override Task OnExecute()

IndexKeysDefinition<MapTransactionAddress> addrIndex = Builders<MapTransactionAddress>.IndexKeys.Ascending(addr => addr.Addresses);
mongoData.MapTransactionAddress.Indexes.CreateOne(addrIndex);

IndexKeysDefinition<MapTransactionAddress> addrBlockIndex = Builders<MapTransactionAddress>.IndexKeys.Ascending(addr => addr.BlockIndex);
mongoData.MapTransactionAddress.Indexes.CreateOne(addrBlockIndex);

IndexKeysDefinition<MapTransactionBlock> trxBlkIndex = Builders<MapTransactionBlock>.IndexKeys.Ascending(trxBlk => trxBlk.BlockIndex);
mongoData.MapTransactionBlock.Indexes.CreateOne(trxBlkIndex);

IndexKeysDefinition<MapRichlist> richListIndex = Builders<MapRichlist>.IndexKeys.Ascending(i => i.Balance);
mongoData.MapRichlist.Indexes.CreateOne(richListIndex);

// This is not needed as the id field is already the index
//var trxIndex = Builders<MapTransaction>.IndexKeys.Ascending(trxBlk => trxBlk.TransactionId);
//this.mongoData.MapTransaction.Indexes.CreateOne(trxIndex);
Expand Down

0 comments on commit 58c46b0

Please sign in to comment.