Details
-
Bug
-
Resolution: Works as Designed
-
Major - P3
-
None
-
4.2.3
-
None
-
Ubuntu 18.04 with XFCE
-
Fully Compatible
-
ALL
-
Description
The below script prints that "950 000" before "970". I'd expect that the given collation makes MongoDB ignore whitespace and treat "950 000" as "950000"
db.dropDatabase();
|
|
|
db.createCollection('test', {
|
collation: {
|
locale: "en_US",
|
numericOrdering: true,
|
alternate: "shifted",
|
maxVariable: "punct"
|
}
|
});
|
|
|
db.test.insertMany([
|
{ price: '970' },
|
{ price: '950 000' }
|
]);
|
|
|
var res = db.test.find({}).collation({
|
locale: "en_US",
|
numericOrdering: true,
|
alternate: "shifted",
|
maxVariable: "space"
|
}).sort({ price: 1 }).toArray();
|
|
|
print(res[0].price); // 950 000
|
print(res[1].price); // 970
|