Support mongoid4 alpha

* TODO: refactor to remove duplication between mongoid3 and mongoid4