"contains" regex queries using collation

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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})

       

            Assignee:
            Eric Sedor
            Reporter:
            Ronaldo Sena
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: