Can you manually set the Last-Modified date in metadata

68 views
Skip to first unread message

ml.se...@medialabinc.com

unread,
Oct 19, 2016, 1:07:39 PM10/19/16
to RavenDB - 2nd generation document database
It's not super important, but one of our devs is looking for documents older than X days, and of course in the development server none of the documents are that old yet and "We can test this in 30 days" tends to irritate the Product Owners ;)

If you manually set the date, it saves it, and overwrites what you put in with DateTime.Now because that's the last time it was modified! 

Is there any way to hack the data so it looks like it was modified in the past?

Derek den Haas

unread,
Oct 19, 2016, 1:50:30 PM10/19/16
to RavenDB - 2nd generation document database
Set your server date 30 in the past, reboot ravendb, save a document, set date back, restart ravendb...

Jahmai Lay

unread,
Oct 19, 2016, 8:46:28 PM10/19/16
to RavenDB - 2nd generation document database

Export to a ravendump, rename it to .zip, decompress, edit the json manually, recompress, import.

Oren Eini (Ayende Rahien)

unread,
Oct 20, 2016, 2:37:56 AM10/20/16
to ravendb
During tests, you can use the SystemTime class to control how RavenDB is setting the time

Hibernating Rhinos Ltd  

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

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

 


--
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.
For more options, visit https://groups.google.com/d/optout.

Oren Eini (Ayende Rahien)

unread,
Oct 20, 2016, 2:37:59 AM10/20/16
to ravendb
Won't actually work.

Hibernating Rhinos Ltd  

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

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

 


--

Jahmai Lay

unread,
Oct 20, 2016, 2:45:03 AM10/20/16
to RavenDB - 2nd generation document database
What is the reason?
Won't actually work.
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 20, 2016, 2:46:55 AM10/20/16
to ravendb
Import is effectively writing the document again, it will update the Last-Modified
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Jahmai Lay

unread,
Oct 20, 2016, 3:17:15 AM10/20/16
to RavenDB - 2nd generation document database
Then I guess the recommendation should be don't use Last-Modified in business rules for "docs older than X days" if you restore from backup and it changes the results.

Oren Eini (Ayende Rahien)

unread,
Oct 20, 2016, 3:21:07 AM10/20/16
to ravendb
Backup is different , that is a binary copy of the data.
Export is writing it all again
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Jahmai Lay

unread,
Oct 20, 2016, 7:28:16 AM10/20/16
to RavenDB - 2nd generation document database

Huh? Doesn't Periodic Backups use smuggler, which is export / import?

Oren Eini (Ayende Rahien)

unread,
Oct 20, 2016, 7:34:23 AM10/20/16
to ravendb
Periodic export, yes.
We also have the binary backups
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

ml.se...@medialabinc.com

unread,
Oct 20, 2016, 7:51:30 AM10/20/16
to RavenDB - 2nd generation document database
For our purposes, the Last-Modified is semantically valid.

In this instance, the dev can simply change the TimeSpan to look for things older than 30 seconds and ensure the process works. He's not testing Raven's ability to mark a document as last modified nor is he testing C#'s TimeSpan object, so his test is valid regardless of the time difference.

However, it's good to know that an export/import effectively sets this field. Makes sense, but it's something I'd not have thought about.
Reply all
Reply to author
Forward
0 new messages