add mongodb support and reorganize