-
Type:
Bug
-
Resolution: Works as Designed
-
Priority:
Major - P3
-
None
-
Affects Version/s: 4.2.3
-
Component/s: None
-
Environment:Ubuntu 18.04 with XFCE
-
Fully Compatible
-
ALL
-
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
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