write propper documents to mongo