Class: Store::Mongodb::EqualFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/store/mongodb.rb

Instance Method Summary collapse

Constructor Details

#initialize(field, value) ⇒ EqualFilter

Returns a new instance of EqualFilter.



227
228
229
# File 'lib/store/mongodb.rb', line 227

def initialize(field, value)
  @field = field; @value = value
end

Instance Method Details

#add_filter(hash) ⇒ Object



231
232
233
234
235
236
237
238
239
# File 'lib/store/mongodb.rb', line 231

def add_filter(hash)
  if @value == 'unknown' 
    hash[@field] = nil
  elsif @value.kind_of?(BSON::ObjectId)
    hash[@field] = @value
  else
    hash[@field] = @value
  end
end