Category: Question and Answers


This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Support for Case Insensitive Sorting in Mongo Find Query


As a user, I am encountering an issue with using the mongodb.collection.sort() method in AppSmith. It sorts text in a case-sensitive manner which is not desirable. I am wondering if the collation() method is supported in AppSmith. If not, I am suggested a workaround using an aggregate query from Stack Overflow, but I am not fond of using unnecessary aggregations.


The issue discussed concerns the case sensitivity of the MongoDB.collection.sort() method, which sorts data in an A-Z, a-z manner. To resolve this issue, MongoDB added the collation() method to sort data in a case-insensitive manner. However, it is not clear whether this feature is currently supported in AppSmith. As a workaround, a user suggested using an aggregation query in Java, which involves passing the $toLower operator as an argument to $sort. This method sorts the data in a case-insensitive manner by converting all letters to lowercase before sorting. While this workaround may not be ideal for large datasets, it can be effective for smaller datasets.