Is "ETag" disallowed as a field name inside a document?

71 views
Skip to first unread message

Jared Russell

unread,
Sep 5, 2015, 11:26:55 AM9/5/15
to RavenDB - 2nd generation document database
Hi,

I've just been trying to use RavenDB backend the for the CacheCow library which internally saves documents with the following structure:

internal class PersistentCacheKey
{
public string Id { get; set; }
public byte[] Hash { get; set; }
public string RoutePattern { get; set; }
public string ResourceUri { get; set; }
public string ETag { get; set; }
public DateTimeOffset LastModified { get; set; }
}

After testing this out I found that the ETag property was not getting saved to the database. I've also been able to repro this with a console app when I save a document with a field named "ETag".

Is this behaviour intentional or a bug? I know that RavenDB uses ETags internally for caching however I could not find any documentation mentioning it being a reserved word.

Thanks,

Jared


Federico Lois

unread,
Sep 5, 2015, 11:37:14 AM9/5/15
to rav...@googlegroups.com
It is a reserved keyword in the metadata. Don't know exactly what could happen if the document itself has the etag field.

From: Jared Russell
Sent: ‎05/‎09/‎2015 12:26
To: RavenDB - 2nd generation document database
Subject: [RavenDB] Is "ETag" disallowed as a field name inside a document?

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oren Eini (Ayende Rahien)

unread,
Sep 6, 2015, 4:15:54 AM9/6/15
to ravendb
Yes, this is allowed, and there is no issue with that.
There are _no_ reserved property names in RavenDB documents.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


ben.j...@flinders.edu.au

unread,
Oct 21, 2016, 2:26:22 AM10/21/16
to RavenDB - 2nd generation document database
Hi Jared,

Did you ever sort this out? I'm having the same issue with CacheCow.

Cheers,

Ben

Oren Eini (Ayende Rahien)

unread,
Oct 21, 2016, 2:33:55 AM10/21/16
to ravendb

It is a safe word to use in the data


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

ben.j...@flinders.edu.au

unread,
Oct 21, 2016, 2:43:48 AM10/21/16
to RavenDB - 2nd generation document database
Hi Oren,

When trying to add a property called "ETag" within the Raven Studio into the data section it just gets removed on saving ... this seems contrary to what you're saying.

Cheers,

Ben
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Oct 21, 2016, 8:58:33 AM10/21/16
to ravendb
Hm..
Correction, that is removed from the document, this is because it is a reserved header name. 
I don't think that we can fix it in this stage for 3.5, though. EntityTag would work, though.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Chris Marisic

unread,
Oct 21, 2016, 4:51:28 PM10/21/16
to RavenDB - 2nd generation document database
Unless your ETag means something entirely different the document version from Raven. You really do not want to do this.

If you use the Raven ETag inside the document it will always be inaccurate. When you save the document, the ETag will increment for the document but it will reflect an older value inside the body of the json, and be inconsistent.

If you want to use Raven ETags, you want to use a document conversion listener to put the ETag on your models on Load and to delete it from your models on persist. 

ben.j...@flinders.edu.au

unread,
Oct 31, 2016, 8:10:35 PM10/31/16
to RavenDB - 2nd generation document database
In this case, ETag means something entirely different (it's the entity tag used to identify the cache entry in CacheCow) - it's easy enough to fix by just changing the property in source and recompiling - it just threw me at first because I knew it was being removed, but Oren indicated that there shouldn't be any reserved property names.

It's all sorted in any case.

Cheers,

Ben
Reply all
Reply to author
Forward
0 new messages