How to execute mongosh commands?


I would like to execute some JavaScript using the mongodb-driver golang library, such as arbitrary code that could be executed with the “eval” function in mongodb < 4.0.

I saw that one can use the “db.RunCommand” method, but my use case is getting the date dynamically in my queries (without using Go, because the date can be provided from a JSON config file).

For example, I would like something like : db.Eval(“ISODate()”)

Thanks in advance.