Sha256: dae9032756b67188d5ae2ee26a765acc77037c0e53d4fb54bb6b6527d820a636
Contents?: true
Size: 717 Bytes
Versions: 14
Compression:
Stored size: 717 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') coll = db.collection('test') # Erase all records from collection, if any coll.clear # Insert 3 records 3.times { |i| coll.insert({'a' => i+1}) } # Collection names in database p db.collection_names # More information about each collection p db.collections_info # Index information db.create_index('test', 'a') p db.index_information('test') # Destroy the collection coll.drop
Version data entries
14 entries across 14 versions & 2 rubygems