Sha256: f4ddc198f070a0a9637f7e92a2dacb1f6e9e35530a91a2d24945fa4841d98e5a
Contents?: true
Size: 735 Bytes
Versions: 16
Compression:
Stored size: 735 Bytes
Contents
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib') require 'mongo' include XGen::Mongo::Driver host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost' port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT puts "Connecting to #{host}:#{port}" db = Mongo.new(host, port).db('ruby-mongo-examples') db.drop_collection('test') # A capped collection has a max size and optionally a max number of records. # Old records get pushed out by new ones once the size or max num records is # reached. coll = db.create_collection('test', :capped => true, :size => 1024, :max => 12) 100.times { |i| coll.insert('a' => i+1) } # We will only see the last 12 records coll.find().each { |row| p row } coll.drop
Version data entries
16 entries across 16 versions & 2 rubygems