Fix deprecation errors with newer versions of the mongo driver