Add compatibility with mongoid.