2

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

RobertTheGrey
  • 8,645
  • 5
  • 32
  • 45

1 Answers1

6

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

this.TestId = __document_id
Adam Larsen
  • 1,121
  • 1
  • 8
  • 13