refactor db.js support sync mongodb