Get distinct values from an aggregation pipeline

Please read Formatting code and log snippets in posts and update your post as it is quite unreadable at the moment, and also please share MongoDB Playground link with sample documents and the query you have used.