Closed hunghvu closed 7 months ago
Sample of idea.
const payload = require('payload');
payload.collections['collection_name'].Model.distinct('field_name', {status: {$eq: '*condition*'}}, async (err, data) => {
if (err) {
// handle error
} else {
// work with unique data values
const uniqueValues = [...new Set(data)];
console.log(uniqueValues);
}
});
Commit 6a1992e reduces payload from the CMS from 80kb to 20kb, and cuts a huge amount of DB operations too.
Consider as done.
Related to #112.