I am connecting to a MongoDB database from AWS Lambda, MongoDB have an article on best practises here https://docs.atlas.mongodb.com/best-practices-connecting-to-aws-lambda.