【发布时间】:2020-09-22 01:52:38
【问题描述】:
我想在 membershipAccount 集合上创建一个索引,该集合有一个排序规则集,允许 find 方法在不区分大小写的情况下找到 username。
[
2,
{
"username" : 1.0
},
"username_1",
"kollecto_prod.membershipAccounts",
{
"locale" : "da",
"caseLevel" : false,
"caseFirst" : "off",
"strength" : 1,
"numericOrdering" : false,
"alternate" : "non-ignorable",
"maxVariable" : "punct",
"normalization" : false,
"backwards" : false,
"version" : "57.1"
}
]
我的membershipAccountscollection 中有一个名为user@test.com 的用户。
但这是我查找查询的结果:
db.getCollection('membershipAccounts').find({username: "user@test.com"}) // 1 result - ok
db.getCollection('membershipAccounts').find({username: "USER@test.com"}) // 0 results - nope
db.getCollection('membershipAccounts').find({username: "USER@TEST.com"}) // 0 results - nope
db.getCollection('membershipAccounts').find({username: "USER@TEST.COM"}) // 0 results - nope
我的排序规则不正确还是我误解了这个概念?
【问题讨论】:
标签: json mongodb collation bson