Details

    • Type: New Feature
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.3 Required
    • Component/s: Indexing
    • Labels:
      None

      Description

      potential syntax:

      db.foo.ensureIndex( { name : 1 } , { caseInsensitive : true } )
      db.foo.ensureIndex( { name : 1 } , { caseInsensitive : true , locale : "FR" } )
      db.foo.ensureIndex( { name : 1 } , { caseInsensitive : true , localeKey : "user.country" } )
       
      db.foo.ensureIndex( { name : 1 } , { caseInsensitive : [ "name" ] } )
      

      reminder, you can aways do this for now:

      { name : { real : "Eliot" , sort : "eliot" } }
      ensureIndex( { "name.sort" : 1 } )
      

        Issue Links

          Activity

          Hide
          turbob Dane Tru added a comment -

          Hello guys... This is a very important feature for almost any application that deals with non-numeric search. It does not make sense that I have to store two copies of every person's name just to get a search that is fast enough.

          Show
          turbob Dane Tru added a comment - Hello guys... This is a very important feature for almost any application that deals with non-numeric search. It does not make sense that I have to store two copies of every person's name just to get a search that is fast enough.
          Hide
          ther Damjan Rems added a comment - - edited

          I also become more and more dependend on alternative sorting.

          I have been thinking about the issue and as I remember I have read somewhere that it was so important to MongoDB team to have fast sorting algorithm that they didn't want to complicate sorting process.

          So lets save data in sorting indexes the way that doesn't change sorting process. My proposal is to replace charachters (binary code) in String keys just before it is saved to index key, with characters provided by collation translation tabels. This also means that find algorithm should do the same operation before index searching is done.

          The other solution would be to replace characters before they are saved to document. As of MongoDB 3.2 encription is available, which does more or less the same thing.

          Mongo team. Please we are waiting alternative sorting for too long.

          by
          Damjan Rems, http://www.drgcms.org

          Show
          ther Damjan Rems added a comment - - edited I also become more and more dependend on alternative sorting. I have been thinking about the issue and as I remember I have read somewhere that it was so important to MongoDB team to have fast sorting algorithm that they didn't want to complicate sorting process. So lets save data in sorting indexes the way that doesn't change sorting process. My proposal is to replace charachters (binary code) in String keys just before it is saved to index key, with characters provided by collation translation tabels. This also means that find algorithm should do the same operation before index searching is done. The other solution would be to replace characters before they are saved to document. As of MongoDB 3.2 encription is available, which does more or less the same thing. Mongo team. Please we are waiting alternative sorting for too long. by Damjan Rems, http://www.drgcms.org
          Hide
          timhardy Tim Hardy added a comment -

          For the love of all that is good, PLEASE add case insensitive indexes! Pretty much all web development involves the ability to search by string, and the standard is case insensitive.

          When you type a search into Amazon, do you expect your search terms to be case sensitive? No, you don't. If you're a web developer and use MongoDb, you have to bend over backwards to provide this incredibly common capability.

          How Mongo can style itself as an enterprise option nowadays and not support this is beyond me.

          Show
          timhardy Tim Hardy added a comment - For the love of all that is good, PLEASE add case insensitive indexes! Pretty much all web development involves the ability to search by string, and the standard is case insensitive. When you type a search into Amazon, do you expect your search terms to be case sensitive? No, you don't. If you're a web developer and use MongoDb, you have to bend over backwards to provide this incredibly common capability. How Mongo can style itself as an enterprise option nowadays and not support this is beyond me.
          Hide
          betoneto.tbo@gmail.com Roberto Germano Vieweg Neto added a comment -

          Another good feature can also be pass a compare function for the sort method, like this:

          db.myEntity.find().sort(function(myEntityA, myEntityB) { 
             return myEntityA.field.toLowerCase().compareTo(myEntityB.field.toLowerCase()); 
          })
          

          Sometimes you need to sort little data, and you doesn't want/need to create an index to do that.

          Show
          betoneto.tbo@gmail.com Roberto Germano Vieweg Neto added a comment - Another good feature can also be pass a compare function for the sort method, like this: db.myEntity.find().sort( function (myEntityA, myEntityB) { return myEntityA.field.toLowerCase().compareTo(myEntityB.field.toLowerCase()); }) Sometimes you need to sort little data, and you doesn't want/need to create an index to do that.
          Hide
          jesperbendtsen83@gmail.com Jesper Erik Bendtsen added a comment -

          Really hope this feature comes in the near future, everyone are used to search in case insensitive way, it really creates headache for developers!
          Meanwhile, I started to save strings with certain style, if I know the field is like that, rather than to create two fields, one for search/sort and one for display who can make the doc huge.

          Example in PHP
          strToUpper () - Make a string uppercase
          strtolower () - Make a string lowercase
          ucfirst () - Make a string's first character uppercase
          ucwords () - Uppercase the first character of each word in a string
          none = Slow search

          So when users save data I change it to one of the above. And when users searching I change the input to above and then do the search/sort.
          If I do not know if the field has a certain style. I use REGEX like this "new MongoDB \ BSON \ Regex ('^'. $ Value. '$', 'In')" which is slow. I really waiting for MongoDB will support case insensitive search...

          Know the above is not super, but maybe it will help someone until case insensitive search comes, really hopes it comes!? This ticket is from 2009, it worries me! Please reply with future plans?

          Show
          jesperbendtsen83@gmail.com Jesper Erik Bendtsen added a comment - Really hope this feature comes in the near future, everyone are used to search in case insensitive way, it really creates headache for developers! Meanwhile, I started to save strings with certain style, if I know the field is like that, rather than to create two fields, one for search/sort and one for display who can make the doc huge. Example in PHP strToUpper () - Make a string uppercase strtolower () - Make a string lowercase ucfirst () - Make a string's first character uppercase ucwords () - Uppercase the first character of each word in a string none = Slow search So when users save data I change it to one of the above. And when users searching I change the input to above and then do the search/sort. If I do not know if the field has a certain style. I use REGEX like this "new MongoDB \ BSON \ Regex ('^'. $ Value. '$', 'In')" which is slow. I really waiting for MongoDB will support case insensitive search... Know the above is not super, but maybe it will help someone until case insensitive search comes, really hopes it comes!? This ticket is from 2009, it worries me! Please reply with future plans?

            Dates

            • Created:
              Updated:
              Days since reply:
              15 weeks ago
              Date of 1st Reply: