title: Spawned function to wait for the spawning transaction to be committed?
body: <p>I have a query making a few changes to the database (changing some collections on a couple of documents), then spawning a function.</p>
  
  <p>The spawned function does not see the changes made in the spawning query.</p>
  
  <p>If the spawned function spawn itself, then it does see the changes the second time it runs (and then do not spawn itself again).</p>
  
  <p>My bet is that the task server picks up the spawned function straight away, right before the MVCC mechanism picks its own timestamp for the end of the transaction.</p>
  
  <p>So I get two related questions:</p>
  
  <ul>
  <li><p>1) how to make sure the spawned function waits for the end of the spawning transaction?</p></li>
  <li><p>2) is it possible to spawn a function, but to be actually put on the task server queue only if the transaction succeeds (and if it fails, does not put it on the task server, resulting in a kind of rollback)?</p></li>
  </ul>
  
  <p>The one solution I can think of now is to use a post-commit trigger, but that sounds a bit convoluted, and my hope is that there is simply an option to do that when spawning the function.</p>