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

Nested $and and $or Query in Mongoid 3

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

      Hello.

      In Mongoid 2 I can write query like this:

      Note.where{"$and" => [{"$or" => [{:message.exists => true}, {:message.ne => 'Hello'}]}, {"$or" =>[{:message_alarm.exists => true},{:message_alarm.ne => "mute"}]}]}
      

      However this syntax is no longer feasible in Mongoid 3, so is there a way to write something like that in Mongoid 3 ?

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

              Created:
              Updated:
              Resolved: