How can I execute Code(...) in a document?

I inserted a record with function.

test > db.testing.insertOne({name:‘testfunc’, sayhi: function(){ console.log(“hi”) } } )

I would like to execute this function, but it is not working.

test> db.testing.findOne({name:‘testfunc’}).sayhi()
TypeError: … unc’}).sayhi is not a function

How can excute the Code(…)?

First time seeing this. Does mongodb support such feature?