Tuesday, 25 April 2017

Passing current time to Mongoose query

I've run into problem. I made field in my Mongoose schema with type "Date":

...
timeOfPassingQuestion: Date,
...

Now, I want to pass current time in hours, minutes, seconds and miliseconds and save it into that field. How should I format my Node variable so I can pass it without errors?

Edit: Also, I forgot to say that I wanna later see how much time user spent answering question by subtracting current time and time that I pulled from DB, timeOfPassingQuestion field.



via Slay29

No comments:

Post a Comment