Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-40097

"contains" regex queries using collation

    XMLWordPrintableJSON

Details

    • Icon: Question Question
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      Hi, I know that regex queries are not allowed with collation indexes, as well explained in this ticket https://jira.mongodb.org/browse/SERVER-29865.

       

      But here is my question: How can I search for a given word in the middle of a string?

      For instance, suppose I have a field "Name": "Lílian Magalhães", how can I find it by only typing "Magalhae".

       

      I've tried this, but with no luck so far:

      db.users.find({$and: [{Name: {$gte: "Magalhae"}}, \{Name: {$lt: "Magalhaf"}}]}).collation({locale: "pt", strength: 1})

       

      Attachments

        Activity

          People

            eric.sedor@mongodb.com Eric Sedor
            ronaldo.sena Ronaldo Sena
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: