Working on conversion functions to mongo DB