I'm trying to write a patch over a Collection that involves getting the current document ID and I was trying to test it to see the output in the RavenDB Studio Patch area which does a good job of showing before and after. I couldn't understand why my script wasn't working the way I expect and I managed to narrow it down to this small piece:

this.TestId = this.__document_id

In the output for my document when running the test is:

TestId: null

But I can see the document Id is users/1234. Does anyone know the correct syntax to pull the document Id out in the JavaScript used by the RavenDB Studio?

RavenDB Version: #2230

没有正确的解决方案

其他提示

Remove the 'this' in front of the '__document_id'.

this.TestId = __document_id
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top