$projectionResultGuid = (Invoke-RestMethod -Method POST -Uri “$urlOldDB/projections/onetime?enabled=yes” -Credential $cred -InFile …/projections/get-all-category-streams.js).name #name is the projection result guid
$seconds = 2
Start-Sleep -s $seconds #give ESDB time to process the projection query before reading result
$listOfCategoryStreams = (Invoke-RestMethod -Uri “$urlOldDB/projection/$projectionResultGuid/result” -Credential $cred)
I have the following Powershell script that inserts a projection query and then later after a hard-coded time-interval it reads the result:
**Obviously this manual sleep before reading the result isn’t exactly foolproof as it raises the possibility of reading an incomplete result before the query (at least this particular one) has had the time to traverse all the events in the system (a recent experience).
Does there exist a way to read the projection result (onetime projection) using the HTTP API where I can be assured that the query has made a full pass of all the events in the system?