Fix the bug in mongodb api that can not init the mongo collection; change the .gitignore to skip test directory