fix mongo querying code to use latest format of mids