getting data from streams

+2 votes
Hello Multichain,

I have created a stream called users, where   each address of the user is stored along with the username. I could get the entire array of objects and  check for a purticular user. But I needed a more effecient method

Is there a way by using say Smartfilters we can pass metadata  value and get the object out ?

 

Please let me know

 

Thanks
asked May 17 by Prashant Bhat

1 Answer

+1 vote

You should put the information you want to retrieve by in the key(s) of stream items, then use liststreamkeyitems to retrieve it rapidly.

answered May 20 by MultiChain
That's not available through smart filters yet, which I think it was his question?
In general smart filters are not for this type of thing. Smart filters are for rules that decide what transactions or stream items are valid, not for logic about how to retrieve them.
But you *could* use a stream filter to ensure that every stream item that has particular data in its JSON structure also had the corresponding keys for rapid subsequent retrieval.
...