$lt: new Date() help


When using:

expires: { $lt: new Date() }

it works, however, when I set the time:

const expiresWhen = (time * 60) * 60
const expires = new Date()
expires.setSeconds(expires.getSeconds() + expiresWhen)

if expires becomes over 2.88 hours (around 10,000 seconds) it doesnt work.

How expires is stored:

Any help or advice would be helpful, thanks!

Hi @Hufeepufee_123 - Welcome to the community

What is the value of time here?

Can you also provide full sample documents in JSON format in case we need to reproduce this on a test environment. In addition to this, can you also detail where / how you’re running the code snippets? I assume from a MongoDB driver but please provide details of those.