The quoted message above could be the reason why it is failing.
My suggestion is to kindly try it out your functions locally on your computer and then time the operations happening to see if the root cause could be from where your MongoDB instance is located or not.
Let me know the outcome.
Thanks.