bson_ext がロード済みだと Timecop で BSON::ObjectId の creation timestamp を制御できないRubybsontimecop MongoDB のドキュメントは ObjectId 型の _id というフィールドを持つ。 ObjectId の先頭 4 バイトはその ObjectId が生成された UNIX timestamp を表現しているので、 ObjectId をアルファベット昇順でソートすると生成時刻の古い順に並ぶ。 http://docs.mongodb.org/manual/reference/object-id/ require 'bson' a = BSON::ObjectId.new # => BSON::ObjectId('531029d64b656ea1f4000000') sleep 1 b = BSON::ObjectId