Create and call a function from mongoshell

I created a function say func1 using mongoshell and within the function I am writing an aggregation pipeline code which at the final stage uses merge to push the results in a separate collection. But when I am trying to execute this function func1 from mongo shell it seems its not working . I am just typing func1 in the mongoshell and hitting enter as suggested in https://docs.mongodb.com/manual/core/materialized-views/
however the pipeline code does not seem to getting executed as no data is pushed to the collection. The aggregation pipeline code works fine when run without calling function.
Need suggestion on this, whether calling a function is even possible using mongo shell?
Also can we schedule a mongodb function also using the mongoshell?
PS: We are not using ATLAS but only the native MongoDB 4.2.15 hosted in AWS cloud.

is insufficient to call a function in js. Try func1().

@Deepak_Rai, if my post help you solved your issue please mark it as the solution so that others know they can follow the advise. This will help keep this forum helpful and efficient.