bcg / em-mongo

EventMachine MongoDB Driver (based off of RMongo)
http://github.com/bcg/em-mongo
141 stars 47 forks source link

update fails with MongoDB 2.4.6 #50

Closed janroesner closed 10 years ago

janroesner commented 10 years ago

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?

janroesner commented 10 years ago

My bad.