
OPERATIONAL DEFECT DATABASE
...

...
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
kateryna.kamenieva commented on Fri, 7 Feb 2020 20:04:55 +0000: Unfortunately, this use case is not supported by the ICU collation. The behavior is matching the available demo tools: http://demo.icu-project.org/icu-bin/collation.html http://demo.icu-project.org/icu-bin/locexp?_=en_US&d_=en&x=col http://www.unicode.org/reports/tr10/#Non-Goals : "Numeric formatting: numbers composed of a string of digits or other numerics will not necessarily sort in numerical order." carl.champain commented on Wed, 29 Jan 2020 19:59:05 +0000: Hi val@karpov.io, Thank you for the report. I was able to successfully recreate the described behavior; I'm passing this ticket along to the appropriate team for further investigation. Updates will be posted on this ticket as they happen. Kind regards, Carl
Run the given script. I ran it using MongoDB server and shell 4.2.3-rc1
Click on a version to see all relevant bugs
MongoDB Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.