Distinct

Finds the distinct values for a specified field across a single collection and returns the results in an array.

[Distinct] - Finds the distinct values for a specified field across a single collection and returns the results in an array.

get

Finds the distinct values for a specified field across a single collection and returns the results in an array. https://docs.codemash.io/api/database/collections/distinct

Authorizations
AuthorizationstringRequired
Path parameters
CollectionNamestringRequired

Collection name - unique, lowercased, collection name without whitespace. E.g., if your collection title you have entered in the CodeMash dashboard is "Business Trips" then collection name would be "business-trips".

versionstringRequired

The CodeMash API version used to fetch data from the API. If not specified, the last version will be used. E.g.: v2

Query parameters
FieldstringRequired

The field for which to return distinct values

Header parameters
Acceptstring Β· enumRequired

Accept Header

Possible values:
X-CM-ClusterstringOptional

API key of your cluster. Can be passed in a header as X-CM-Cluster.

X-CM-ProjectIdstringRequired

ID of your project. Can be passed in a header as X-CM-ProjectId.

CultureCodestringOptional

Specify culture code when your response from the API should be localised. E.g.: en

Responses
200

Success

application/json
get
/{version}/db/{CollectionName}/distinct
200

Success

[Distinct] - Finds the distinct values for a specified field across a single collection and returns the results in an array.

post

Finds the distinct values for a specified field across a single collection and returns the results in an array. https://docs.codemash.io/api/database/collections/distinct

Authorizations
AuthorizationstringRequired
Path parameters
CollectionNamestringRequired

Collection name - unique, lowercased, collection name without whitespace. E.g., if your collection title you have entered in the CodeMash dashboard is "Business Trips" then collection name would be "business-trips".

versionstringRequired

The CodeMash API version used to fetch data from the API. If not specified, the last version will be used. E.g.: v2

Header parameters
Acceptstring Β· enumRequired

Accept Header

Possible values:
X-CM-ClusterstringOptional

API key of your cluster. Can be passed in a header as X-CM-Cluster.

X-CM-ProjectIdstringRequired

ID of your project. Can be passed in a header as X-CM-ProjectId.

CultureCodestringOptional

Specify culture code when your response from the API should be localised. E.g.: en

Body
FieldstringRequired

The field for which to return distinct values

FilterstringOptional

A query that specifies the documents from which to retrieve the distinct values

Responses
200

Success

application/json
post
/{version}/db/{CollectionName}/distinct
200

Success

Last updated

Was this helpful?