public IEnumerable <SyncBlockInfo> BlockGetIncompleteBlocks() { // note this field is not indexed FilterDefinition <MapBlock> filter = Builders <MapBlock> .Filter.Eq(info => info.SyncComplete, false); return(MapBlock.Find(filter).ToList().Select(Convert)); }
public IEnumerable <SyncBlockInfo> BlockGetBlockCount(int count) { FilterDefinition <MapBlock> filter = Builders <MapBlock> .Filter.Exists(info => info.BlockIndex); SortDefinition <MapBlock> sort = Builders <MapBlock> .Sort.Descending(info => info.BlockIndex); return(MapBlock.Find(filter).Sort(sort).Limit(count).ToList().Select(Convert)); }
public SyncBlockInfo BlockGetByHash(string blockHash) { FilterDefinition <MapBlock> filter = Builders <MapBlock> .Filter.Eq(info => info.BlockHash, blockHash); return(MapBlock.Find(filter).ToList().Select(Convert).FirstOrDefault()); }