Open graham-sportsmgmt opened 6 years ago
+1 Facing the same issue
We are facing the same issue as well.
+1. This issue also appear in createDocument
+1
+1
+1
+1
_ts is not assigned until end of transaction and that is after script code is finished, this means that while script (sproc) is running _ts is not yet available for documents change by current script transaction. For script transactions, same _ts (and same LSN) will be assigned to all docs updated as part of the transaction.
I guess that doesn't help much, as you would still need to obtain the _ts of a doc updated within script. Using JS ways like new Date object is one way though in some cases it may differ from actual one in updated docs. Anyhow, from within script it's not possible to retrieve transaction _ts. On client side that would be possible but I don't think there is a header for that. Nevertheless will look into adding one.
It's great indeed to see a response 3 years later.
I have written a Stored Procedure to do a partial Document update and I want to return only the _ts attribute in order for subsequent queries to use this as a parameter.
This was tested in the Azure Portal Data Explorer and using the node.js sdk, both had the same result.
Whether I use
upsertDocument
orreplaceDocument
these are the only four system attributes returned in the RequestCallback.resource:The Document itself is updated properly by the Stored Procedure, and the changes (including the new _ts) can be verified immediately in Data Explorer.
I also tried executing a small query after the upsert/replace and even this doesn't work inside the same Stored Procedure:
Return value from Stored Procedure:
Result in Data Explorer (run as SQL Query):
Stored Procedure code:
Here is the node.js code that calls the Stored Procedure: