Category: How do I do X?
Updated

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 distinct in Mongo Query

Issue

I need help with a mongo query using the RAW query type. I want to retrieve all the distinct values of a particular property in the collection. The distinct keyword is supported by mongo, but it doesn't seem to be working in the RAW query. Additionally, when I try to include sorting, it gives me a BSON error.

Resolution

The user was attempting to hook up a mongo query using the RAW query type. They were looking for a method or tag that would give all the distinct "name" in the mongo query example they provided. The solution was to use the "distinct" keyword in mongoDB, which provides a list of distinct values of a property from the collection. The syntax is {distinct: "", key: ""}. However, when attempting to sort the results by property name, there was a BSON error. No further solution was provided in the conversation.