add write to file
added mongodb support
quick and dirty but working. not quite well because the format is not unified.