Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs Menu
Docs Home
/
MongoDB Meta Documentation
/

Eval Role

Warning

This extension is both experimental and potentially slow.

You can execute an arbitrary Python expression using the eval role. This expression has access to the Python datetime module.

For example:

It is now
:eval:`int((datetime.datetime.now() - datetime.datetime(2010, 1, 1)).days / 365.2425)`
years since 2010.

Tip

Back

Code Examples