dbm to mongo porting util, set save state function, ensure index in mongodb collection