Mongo db session support

merge to master branch