The object store is a non-relational database, and therefore, the commands and processes differ from those typically used in relational databases.
In this article, we will show how to perform grouping of identical items within an object store (equivalent to the "distinct" command in relational databases) and also count how many objects are stored.
Distinct
Within the object store component, change the operation to "Aggregate," and in the query, add the following command, replacing "$price" with the field you want to group by:
[{
$group: {_id: null, uniqueValues: {$addToSet: "$price"}}
}]
Executing this operation will result in an output containing only the unique values.
Count
To count the number of records, simply use the following command, in the same way as done above (Operation: Aggregate).
[{
$group: {_id: null, count: { $sum: 1 }}
}]
This operation will return the quantity of records stored in this object store.