refactor db to mongo