Module: MongoQueryGrammar::AndExpression1

Defined in:
lib/mongo-query/mongo_query_grammar.rb

Instance Method Summary collapse

Instance Method Details

#to_mongoObject



87
88
89
90
91
92
93
94
95
96
# File 'lib/mongo-query/mongo_query_grammar.rb', line 87

def to_mongo
  res = binary_expression.to_mongo
  new_res = and_expression.to_mongo
  res.each do |key,value|
    if new_res.has_key?(key)
      value.merge!(new_res.delete(key))
    end
  end
  res.merge(new_res)
end