update mongo api to replace deprecated code