Mongoid 4 changes

thank you for your great work. I couldn't make mongoid 4 branch work so made some changes. It works now