Criteria for querying Sets is invalid

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • 2.4.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Consider the following:

      
        field :roles, :type => Array
        scope :admins, any_in('roles' => ['admin'])
      

      it works as expected and produces the following criteria:
      <pre>

      <Mongoid::Criteria

      selector: {"roles"=>{"$in"=>["admin"]}},
      options: {},
      class: User,
      embedded: false>
      </pre>

      now, if I change the Array to Set, e.g. field :roles, :type => Set , then the produced criteria is wrong:

      <pre>

      <Mongoid::Criteria

      selector: {"roles"=>{"$in"=>[[["admin"]]]}},
      options: {},
      class: User,
      embedded: false>
      </pre>

              Assignee:
              Unassigned
              Reporter:
              Roman
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: