none
Combining several Cosmos DB results to one

    Question

  • I have a Logic App that retrieves several results from a Cosmos DB. In all i have 24 Documents results. I need to combine these into one final package that can be delivered to the end customer.

    I tried several ways of doing this, but none of them really works.

    Getting the 24 results is really fast and nice.

    If I parse the document Items to a single array variable it takes forever. The result this would produce is the the result I want, but the time it takes is unacceptable. If I add the bodies to an array variable speed is excellent, but the customer has to unpack the objects.

    I tried converting the Documents to strings, removing the leading and trailing box-brackets, converting everything to one loooong string, but that does not result in a nice json for the customer to consume - but it is fast.

    Is there some smart way to merge several Cosmos DB results into one in a speedy fashion?

    I tried some stored procedure stuff on the Cosmos DB side as well, but my data is in different partitions, which makes that approach pretty steep.

    Friday, May 24, 2019 2:38 PM

All replies

  • After spending 8 hours getting Logic Apps to perform my bidding without any luck, I ended up spending an hour creating a PowerShell Azure Function that does exactly what I want in a few seconds.

    I would still love to hear about a way to do this in Logic Apps though.

    Saturday, May 25, 2019 3:35 PM
  • Can you try using Compose action

    Thanks Sovit

    Monday, May 27, 2019 9:33 AM