Question

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

No correct solution

OTHER TIPS

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

this.TestId = __document_id
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top