MongoDb capped collection

521 Views Asked by At

can u help me pls as i surfed around but didn't find any information. I'm working with mongoDB capped collection using Ruby. I need to update documents according to the id i retrieve from the query, but it never works. here is the example of my code

cursor = coll.find({"EndTime" => nil})

begin

  while row = cursor.next_document
    if !alive row["Pid"]
      coll.update({"_id"=>row["_id"]}, { "$set" =>  { "EndTime" =>Time.now}})
    end
  end

rescue

end

thanx a lot

1

There are 1 best solutions below

0
On BEST ANSWER

Objects in a capped collection are not allowed to grow. Make sure that when you insert you already have space for "EndTime" preallocated.