Replace deprecated mongo api call.