Deal with deprecations in mongo-java-driver v2.12

Fixes #1579