bcg/em-mongo

update fails with MongoDB 2.4.6

janroesner opened this issue · 1 comments

I am trying to bulk update a number of documents in a collection:

def initialize
  @db            = EM::Mongo::Connection.new('localhost').db('ats_development')
  @listings      = @db.collection('listings')
end

def update
  @listings.update({ state: 'changed' }, { state: 'processing' }, {:multi => true})
end

I'm facing two problem here. First, if I set :multi to true, no document is udpdated at all. Second, if I omit :multi the first document is updated with it's new state, but all other attributes of the record are set to nil.

I followed the docs in the source. Am I doing something wrong here, or is this actually a bug?

My bad.