Expiration in R4-RC1

54 views
Skip to first unread message

Marcelo Volmaro

unread,
Sep 13, 2017, 11:03:43 AM9/13/17
to RavenDB - 2nd generation document database
In the latest beta I setup the expiration of an entity in the following way:
Session.Advanced.GetMetadataFor(value)[Constants.Documents.Expiration.ExpirationDate] = date.ToString("O");
and 
Session.Advanced.GetMetadataFor(value).Remove(Constants.Documents.Expiration.ExpirationDate);
to remove the expiration. That now doesn't even compile since there is no Expiration in Documents

What it the correct way to do that now?

Grisha Kotler

unread,
Sep 13, 2017, 11:26:59 AM9/13/17
to rav...@googlegroups.com
You can use: Constants.Documents.Metadata.Expires

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Grisha Kotler l RavenDB Core Team Developer Mobile: +972-54-586-8647

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

RavenDB paving the way to "Data Made Simplehttp://ravendb.net/


--
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.

Marcelo Volmaro

unread,
Sep 13, 2017, 11:30:57 AM9/13/17
to RavenDB - 2nd generation document database
Perfect. And... do I need to enable expiration somewhere? Or it is enabled by default? Because on previous betas, while the metadata was being updated, Raven never expired any document...
You can use: Constants.Documents.Metadata.Expires
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Grisha Kotler

unread,
Sep 13, 2017, 11:34:57 AM9/13/17
to rav...@googlegroups.com
You need to enable it in Settings -> Document Revisions

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Grisha Kotler l RavenDB Core Team Developer Mobile: +972-54-586-8647

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

RavenDB paving the way to "Data Made Simplehttp://ravendb.net/


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

Grisha Kotler

unread,
Sep 13, 2017, 11:41:16 AM9/13/17
to rav...@googlegroups.com
Sorry, there shouldn't be any configuration for document expiration.

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Grisha Kotler l RavenDB Core Team Developer Mobile: +972-54-586-8647

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

RavenDB paving the way to "Data Made Simplehttp://ravendb.net/


Marcelo Volmaro

unread,
Sep 13, 2017, 12:47:10 PM9/13/17
to RavenDB - 2nd generation document database
Ok, so it should work out of the box then...

Oren Eini (Ayende Rahien)

unread,
Sep 13, 2017, 11:54:37 PM9/13/17
to ravendb
Yes, but IIRC, the default config is to expire documents every 5 minutes or so

Hibernating Rhinos Ltd  

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

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

Marcelo Volmaro

unread,
Sep 17, 2017, 4:20:10 PM9/17/17
to RavenDB - 2nd generation document database
I can confirm you that expiration is not working. It was not working on previous betas neither, but I though it was because, well, it was a beta release.

Right now, I have a DB with some documents that have expiration, the db was running for a couple of days and the documents are still there.
Here you have an extract of the metadata of one document...

"@metadata": {
        "@collection": "AuthenticationTokens",
        "Raven-Clr-Type": "DDS.Webloader.Service.Entities.AuthenticationToken, DDS.Webloader.Service",
        "@expires": "2017-09-14T20:00:31.1727948Z"
   }

Just for you to see that there is actually an expiration date set on the document...

Fitzchak Yitzchaki

unread,
Sep 18, 2017, 1:43:39 AM9/18/17
to <ravendb@googlegroups.com>
In order for expiration to be active you need to activate it using the expiration configuration.

Currently it isn't exposed in the studio:

The reason that we have this configuration is to let the user activate or disable the expiration on the database level, so for example it would be possible to disable expiration and import old smuggler file with documents that has the @expires which should be expired this way we have an option to import and not delete them right in the import process.

Best Regards,

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Fitzchak Yitzchaki l Senior Software Engineer Mobile:+972-58-345-9538

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

Tal Weiss

unread,
Sep 18, 2017, 4:00:22 AM9/18/17
to RavenDB - 2nd generation document database
One can activate the expiration bundle by modifying the database record in the studio, right?
Not saying its the best way, but a workaround for now. 

Oren Eini (Ayende Rahien)

unread,
Sep 18, 2017, 4:02:07 AM9/18/17
to ravendb
Yes, but we intentionally don't provide UI for that.
You can do that with a REST call, 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

 


On Mon, Sep 18, 2017 at 11:00 AM, Tal Weiss <t...@ayende.com> wrote:
One can activate the expiration bundle by modifying the database record in the studio, right?
Not saying its the best way, but a workaround for now. 

Marcelo Volmaro

unread,
Sep 18, 2017, 8:40:17 AM9/18/17
to RavenDB - 2nd generation document database
Ok, perfect. How would I enable it then while waiting for RC2? I would like to start testing some of the tools I migrated from Raven 3 to Raven 4, but without expiration it is impossible, as I need the DB to be purged of old documents so it doesn't grow unbounded.
Of course I can create my own expiration method/thread, but I would prefer to use the already existing one... 

Oren Eini (Ayende Rahien)

unread,
Sep 18, 2017, 9:00:05 AM9/18/17
to ravendb
Do a PUT on /admin/databases?name=DB_NAME

The content should the JSON value of the database record (take it from here: http://4.live-test.ravendb.net/studio/index.html#databases/settings/databaseRecord?&database=Northwind )

And add:

"Expiration": { "Active": true }

Note that this will apply expiration only to values created while this is active
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Fitzchak Yitzchaki

unread,
Sep 18, 2017, 9:18:33 AM9/18/17
to <ravendb@googlegroups.com>


Best Regards,

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Fitzchak Yitzchaki l Senior Software Engineer Mobile:+972-58-345-9538

Fitzchak Yitzchaki

unread,
Sep 18, 2017, 9:19:05 AM9/18/17
to <ravendb@googlegroups.com>
Reply all
Reply to author
Forward
0 new messages