Welcome to the Developer Q&A for the MultiChain private blockchain platform.

Please feel free to ask questions about the platform to receive answers from the developers or other members of the community.


+1 vote

I have inserted multiple records to stream using publismulti and I am trying to get the summary of records with same key MC2(more than 10) but facing below issue.

getstreamkeysummary stream1 MC2 jsonobjectmerge,recursive,ignoreother

The above command returns only the last inserted record to the stream with key MC2.

How can i get summary of all the items with the same key.

asked Jan 11 by blkchain_enthu

1 Answer

0 votes

If you want just the list of items, use liststreamkeyitems. The getstreamkeysummary command is for summarizing multiple items in various ways and won't return the individual items. If you're looking for some other type of summary other than JSON merging, please let us know what?

answered Jan 11 by MultiChain
I am actually trying JSON merging.

publishmulti stream1 '[{"keys":["11111-11111","20180101","MC2"],"data":{"json":{"name":"Item1","dob":"01012019"}}},{"keys":["22222-22222","20180102","MC2"],"data":{"json":{"name":"Item2","dob":"02012019"}}}]'

Two JSON records published to stream1 successfully.

Now i want to merge both the data with key MC2, so i am trying below command.

getstreamkeysummary stream1 MC2 jsonobjectmerge,recursive,ignoreother

But what i get as result is below.(the last inserted record)

    "json" : {
        "dob" : "02012019",
        "name" : "Item2"

But I am expecting both the reords should be merged.
This is what we mean by a JSON object merge. What were you expecting?