forked from the MongoDB adapter, fix things
fix things up, ready for using now.