Fixed compatibility with Mongoid 4.x.