Make it play nicely with mongoid 4

Also increase min mongoid version to 3.1 to utilize cache_count field