Setting expiration using Ottoman

Is there currently a way to set the expiration of a document at time of creation (save) using Ottoman? I’ve been trying to look for documentation on it and haven’t found anything.

My use case for this is implementing sessions that expire after an hour. Appreciate the help!

1 Like

@brett19 Sorry to loop you in here, figured you might know more about Ottoman to get an answer on this.

Hey @justin.laveroni,

Have you tried something like this?:{ "expiry": 3600 }, (error, result) => {});

It should take the same options as found in the vanilla SDK here:

Let me know if that works for you.


Hi @nraboy,
thanks to your videos, I’m using Ottoman to model my data.
now I want to Develop a User Profile Store and Session Store with Node.js and use Ottoman to make my model.
1- Is it needed to model sessions store in ottoman?
var SessionModel = ottoman.model(“Session”, {
pid: “string”
2- how to set {expiry:3600}?
I implemented your suggested above approach, but I’m getting this error:
TypeError: callback is not a function

Pulling @brett19 into this as he is the engineer that created Ottoman.