Display all data that saves on the Trie

I was looking at the “Super Heroes” demo code from Motoko playground and I can see there’s a function read() that we can use to read a super hero via ID, now I wonder how can I display all the heroes that has been created?

Any one can help please? I’m struggling already 3 days trying to figure it out.

1 Like
  import Iter "mo:base/Iter";
  public query func dump() : async [(SuperheroId, Superhero)] {
    Iter.toArray(Trie.iter(superheroes))
  };
2 Likes

That works… thank you!! @chenyan, you are a life saver…

1 Like

Works Good! Thank You For This…