[JAVA-2890] Collation not working for count() Created: 21/Jun/18  Updated: 21/Jun/18  Resolved: 21/Jun/18

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 3.4.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Lokesh Reddy Assignee: Ross Lawley
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Tested In : 

Monogb Version : 3.4.13 

Spring Data Mongo DB - 2.0.3.RELEASE

Collation is working fine when we use find() ,But doesn't  seem to be working using count()

db.test.count({headline:'Developer'}).collation({locale:'en_US', strength:2});



 Comments   
Comment by Ross Lawley [ 21/Jun/18 ]

Hi reddylokesh,

Thats because in the shell `db.test.count()` returns a number, so you can't chain the collation like that. See operations that support collation in the documentation. I believe you will need to change the form to use `db.collection.find(query, options).count()`.

Just to let you know for future reference this project is for Java driver bugs or feature requests. The best place for questions regarding MongoDB usage or the Java driver specifics is the mongodb-user mailinglist or stackoverflow as you will reach a boarder audience there. If your business requires an answer from MongoDB within a time frame then we do offer production support.

I hope that helps,

Ross

Comment by Lokesh Reddy [ 21/Jun/18 ]

Hi Ross ,

It is not working in mongo shell either .

mongo shell is not related to spring data mongodb .

db.test.count({headline:'Developer'}).collation({locale:'en_US', strength:2});

The above returns collation is not a function ..

However this works db.test.find({headline:'Developer'}).collation({locale:'en_US', strength:2}).count();

 

Comment by Ross Lawley [ 21/Jun/18 ]

Hi reddylokesh,

I think this ticket has been misfiled and perhaps should be in the Spring Data Jira project. The Java driver supports collations with count and has a test case here: CountOperationSpecification.groovy

If it hasn't been misfiled please comment and with further information and I'll investigate.

Ross

Generated at Thu Feb 08 08:58:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.