title: Mongoose remove duplicate values
body: <p>I have <strong>products</strong> collection and every document in it has a category, e.g. shoes, jackets ..etc, I want to to get these categories without the duplicates values, i tried to use <strong>unique</strong> and <strong>dropDups</strong> like this</p>
  <pre><code>const getCategories = async (req, res) =&gt; {
    try {
      const categories = await Men.find(
        {},
        { category: 1, _id: 0, unique: true, dropDups: true }
      ).select(&quot;category&quot;);
      res.status(200).json(categories);
    } catch (err) {
      console.log(err);
      res.status(400).json(err);
    }
  };
  </code></pre>
  <p>but its not working, so how to remove duplicate values ?</p>