Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1580

Criteria for querying Sets is invalid

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.4.1
    • Affects Version/s: None
    • Component/s: 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 Unassigned
            Reporter:
            romanbsd Roman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: