added code for mongo db