Checking how much time passed from creating objectid in mongodb

I'm building an app that allows the user to reset his password. The process is really simple .The user enters his email address and I sending him a link with the number of the new objectid that was created. For exemple -> /reset-password?x=55555444475d41a000001. After clicking the link he reaches other page and then I want to check if 24 hours have passed from the time he got the link?and yes i know there is function called "getTimestamp" but how to use it..?

get: function (request, response) {

  ???????

},

You can set a "creation_date" property in your object when you create it, like this:

obj = {
    id: "xxxxxx...",
    creation_date: new Date()
    ...
}

Then you store the object somewhere in your server, and then when the user opens the link with the id of the object you will do something like this to check if the object has been created more than 24hours ago:

var now = new Date();

if (now - obj.creation_date > 86400000) {
    // more than 24h (86400000ms = 24h)
    // do something
}

Actually reading the JavaScript API docs for ObjectId might help.

Checking wether 24 hours have passed since the creation of the object should be as easy as

var now = new Date();

/* Subtract the milliseconds a day lasts from the current time.
 * If the timestamp of the ID converted to msecs after epoch is smaller
 * the ObjectId was created before that.
 */
if ( myId.getTimestamp() < ( now.getTime() - 86400000 ) {
  console.log("24 h have passed since creation");
}
else {
  console.log("24 h haven't passed since creation");
  var passed = new Date( now - myId.getTimestamp() );
  console.log(passed.getUTCHours()+":"+passed.getUTCMinutes()+" have passed.");
}

Note: I downvoted your question as it would have been easily solvable by googling "MongoDB ObjectId getTimestamp JavaScript api", you didn't show any sign of working on the problem yourself and didn't bother to ask a specific question. May I politely suggest reading ESR's How To Ask Questions The Smart Way, especially the chapter about StackOverflow?