MongoDb capped collection
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.
精彩评论