开发者

MongoDb capped collection

开发者 https://www.devze.com 2023-02-03 05:05 出处:网络
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,

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,开发者_如何学C 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消