# NodeJS Expiration Policy

**URL:** <https://discuss.aerospike.com/t/nodejs-expiration-policy/2558>\
**Category:** Operations\
**Created:** [February 26, 2016, 3:59pm UTC](https://discuss.aerospike.com/t/nodejs-expiration-policy/2558 "2016-02-26T15:59:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fdnieves](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@fdnieves](https://discuss.aerospike.com/u/fdnieves)\
**Post date:** [February 26, 2016, 3:59pm UTC](https://discuss.aerospike.com/t/nodejs-expiration-policy/2558/1 "2016-02-26T15:59:32Z")

</div>

Hello there,

Is there any way in nodejs to update a record and not changing its TTL ?

If that’s not possible, is there any way to set expiration date for a record? So when first I read a record I save its TTL and then when updating it, I set the same TTL as it had before.

Thanks!

---

<div class="post-metadata">

**Author:** ![ronny1204](https://avatars.discourse-cdn.com/v4/letter/r/6de8d8/32.png) [@ronny1204](https://discuss.aerospike.com/u/ronny1204)\
**Post date:** [February 26, 2016, 9:10pm UTC](https://discuss.aerospike.com/t/nodejs-expiration-policy/2558/2 "2016-02-26T21:10:27Z")

</div>

You can use UDFs and, as you said, save the first TTL in a bin. Everytime you want to update a record, use an UDF to:

1. Updates the bin(s) you need

2. Reset the TTL using the original TTL you stored using `record.set_ttl(rec, ttl)`

---

<div class="post-metadata">

**Author:** ![fdnieves](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@fdnieves](https://discuss.aerospike.com/u/fdnieves)\
**Post date:** [February 26, 2016, 9:29pm UTC](https://discuss.aerospike.com/t/nodejs-expiration-policy/2558/3 "2016-02-26T21:29:23Z")

</div>

**edited because incomplete answer of mine**

Hi ronny, thanks for your quick response.

I believe you said that because there is no way to do the same with nodejs client, is that right?

Thanks,
