[SERVER-40097] "contains" regex queries using collation Created: 12/Mar/19  Updated: 13/Mar/19  Resolved: 13/Mar/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Ronaldo Sena Assignee: Eric Sedor
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

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

 



 Comments   
Comment by Eric Sedor [ 13/Mar/19 ]

Hello; The SERVER project is for bugs and feature suggestions for the MongoDB server. For exploring how to best use MongoDB for your use-case, please post on the mongodb-user group or on Stack Overflow with the mongodb tag.

Our Technical Support page may also be of help.

Generated at Thu Feb 08 04:54:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.