I have a collection with a string field called named in my Mongoid based class. I’d like to be able to query for all documents that begin with the letters in the a through f in the name field, case insensitive. What’s the best way to do this through Mongoid? I’m assuming the interface is similar to ActiveRecord, so if it can be done in ActiveRecord, it can probably be done through Mongoid as well.
I have a collection with a string field called named in my Mongoid based
Share
This will do the trick
i – for case insensitive