RavenDB Studio - Patch can't find this.__document_id

487 views Asked by At

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

1

There are 1 answers

4
Adam Larsen On

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

this.TestId = __document_id