سؤال

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