title: Variable user selection
body: <p>I need to create some variation for the user, so that he can select only those users for whom he specifies a category (search by category) or those who do not have the same categories as in the array (in the code you can see the array).
  I used the documentation and found this answer: operator <a href="https://www.mongodb.com/docs/manual/reference/operator/query/ne/" rel="nofollow noreferrer">$ne</a></p>
  <p>But it is not works, I get a list of all users</p>
  <pre class="lang-golang prettyprint-override"><code>func (r *Mongo) User(ctx context.Context, query *domain.Query) ([]*User, error) {
      var filter interface{}
      if query.Query != &quot;&quot; {
          filter = bson.D{primitive.E{Key: &quot;status&quot;, Value: true}, primitive.E{Key: &quot;category&quot;, Value: query.Query}}
      } else {
          filter = bson.D{primitive.E{Key: &quot;status&quot;, Value: true}}
      } - this works
  
      if query.OtherCategory {
          category := []string{&quot;it&quot;, &quot;medical&quot;, &quot;sport&quot;}
          filter = bson.M{&quot;status&quot;: true, &quot;category&quot;: bson.M{&quot;$ne&quot;: category}}
      } - this it is not works
  
      cursor, err := r.col.Find(ctx, filter, opts)
  
      var results []*domain.User
      if err = cursor.All(ctx, &amp;results); err != nil {
          r.logger.Error().Err(err).Msg(&quot;failed find&quot;)
          return nil, err
      }
  
      return results, nil
  }
  </code></pre>
  <p>How to make a query to get a list of users who don't have these (array of categories in the code) categories in the array, and their status is true?</p>