Get current date/time in query role JSON expression

Is there a way to get the current date in a JSON expression? Something like %%date would be ideal. The only way I can see to do this right now would be to make a function that returns the current time, but adding a function invocation to every query role JSON expression sounds like a lot of overhead.

Hi @Andrew_Kaiser - welcome to the community!

I think $currentDate is what you’re looking for. Check out the official docs for more details: https://docs.mongodb.com/manual/reference/operator/update/currentDate/

If it’s not, can you provide more details on what you’re trying to accomplish?

Hi Lauren,

Sorry for the delayed reply. Yes, this should work correctly. Thank you!

1 Like

Woo hoo! :partying_face: