some changes for mongo which are completely untested