2
donuts
6y

Web dev (JS, node) question since there are so many here... I think...

I want to return a JSON array as a stream so the server passes whatever the DB returns but also normalize each record.

Also the data is across several collections. Is it possible to return this in a single request?

And how do I add in error handling? If there's an error in between the user already has part of the data?

Comments
  • 0
    @Hubot-0x58 what I have now is I run 2 queries and storr the results in like a Map then return the whole map.

    What I was thinking is run one query after another and return the results as they are being returned (streaming) from the DB so I don't have to make a Map/hold all the data before it gets returned
  • 0
    @Hubot-0x58 no they're like 2 different data sources so just wondering if there's a way to return it all in a single call or have to have the requestor get on at a time
  • 0
    @Hubot-0x58 it's for work. The issue is how to stream 2 queries as 1 response but I think I may know though needs to be tested... Guess I'll do it when I need it, go with the brute force way first...
Add Comment