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.

See also:

Back

Code Examples