avoid using deprecated function in mongoDB driver