We are looking for a query which will get in getting the list of unique attributes in a collection by scanning all the documents .We are not going with MongoDB Compass Schema Option as we are having the schema being analyzed for 1000 records .
We have tried something to pull manually by using the below query .
This works in local but not working as expected in the Sharded collection.
When we tried to run by each stage there is some issue with the $group stage .
Could you please clarify whether you are looking for the query for all the documents or only 1000 of them? I understand that Compass analyzes only 1000 documents, but I would appreciate it if you could confirm your approach.
Could you share what is not working, and if possible, share the error message you are receiving?
Could you please explain the issue you are encountering with the $group stage?