The bug / fix is that the duration is placed in the milliseconds parameter of the TimeSpan constructor. This should be in the seconds parameter. This is highlighted in his notes, below.
So when I specify my Expiry as 2592000 = 30 days my doc is expiring in 41 minutes.
Turns out they are asking users to specify seconds but using it as milliseconds - var result = Upsert(document.Id, document.Content, document.Cas, document.Expiry.ToTtl());
There is a discrepancy between the server documentation and the SDK documentation ( here too) regarding TTL. The SDK expects milliseconds to be passed in and it will handle the conversion specified in the server documentation to Unix time; this is for convenience. The reason the SDK uses milliseconds is because it’s a more standardized way of specifying a TTL than seconds from an API perspective.
Note that there are additional overloads (but none for Document), which take a TimeSpan as the TTL; for those methods it’s preferable over the overloads that take a unsigned int.
I opened up a ticket to address this here. Sorry for any confusion this may have caused.
Actually I believe uint is 49 days; agreed ulong would be better. The suggested work around is to use one of the overloads that takes a K/V pair and not a document and includes a TimeSpan for an expiry.
I created a ticket here to add a property to IDocument and/or change the Type to ulong: Loading.... This would be a potentially breaking change, so it won’t likely be addressed until the next major release.