diff --git a/examples/admin.rb b/examples/admin.rb index ba5fdc0..d44ac81 100644 --- a/examples/admin.rb +++ b/examples/admin.rb @@ -12,7 +12,7 @@ db = Connection.new(host, port).db('ruby-mongo-examples') coll = db.create_collection('test') # Erase all records from collection, if any -coll.clear +coll.remove admin = db.admin diff --git a/examples/benchmarks.rb b/examples/benchmarks.rb index 41126b0..f50c466 100644 --- a/examples/benchmarks.rb +++ b/examples/benchmarks.rb @@ -9,7 +9,7 @@ port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Connection::DEFAULT_PORT puts "Connecting to #{host}:#{port}" db = Mongo::Connection.new(host, port).db('ruby-mongo-examples') coll = db.collection('test') -coll.clear +coll.remove OBJS_COUNT = 100 TEST_COUNT = 100 @@ -22,13 +22,13 @@ puts "Running benchmark" Benchmark.bmbm do |results| results.report("single object inserts: ") { TEST_COUNT.times { - coll.clear + coll.remove arr.each {|x| coll.insert(x)} } } results.report("multiple object insert: ") { TEST_COUNT.times { - coll.clear + coll.remove coll.insert(arr) } } @@ -39,4 +39,4 @@ Benchmark.bmbm do |results| } end -coll.clear +coll.remove diff --git a/examples/blog.rb b/examples/blog.rb index 5d0fcc7..27b3f12 100644 --- a/examples/blog.rb +++ b/examples/blog.rb @@ -21,7 +21,7 @@ LINE_SIZE = 120 puts "=" * LINE_SIZE puts "Adding authors" authors = DB.collection "authors" -authors.clear +authors.remove authors.create_index "meta", '_id' => 1, 'name' => 1, 'age' => 1 puts "-" * LINE_SIZE shaksp = authors << { :name => "William Shakespeare", :email => "william@shakespeare.com", :age => 587 } @@ -36,7 +36,7 @@ authors.find({}, :sort => [{'age' => 1}]).each {|x| puts "%-25.25s : %-25.25s : puts "=" * LINE_SIZE puts "Adding users" users = DB.collection "users" -users.clear +users.remove # users.create_index "meta", :_id => 1, :login => 1, :name => 1 puts "-" * LINE_SIZE jdoe = users << { :login => "jdoe", :name => "John Doe", :email => "john@doe.com" } @@ -51,7 +51,7 @@ users.find({}, :sort => [{'login' => 1}]).each {|x| puts "%-10.10s : %-25.25s : puts "=" * LINE_SIZE puts "Adding articles" articles = DB.collection "articles" -articles.clear +articles.remove # articles.create_index "meta", :_id => 1, :author_id => 1, :title => 1 puts "-" * LINE_SIZE begin diff --git a/examples/cursor.rb b/examples/cursor.rb index fa37ae4..bbba353 100644 --- a/examples/cursor.rb +++ b/examples/cursor.rb @@ -12,7 +12,7 @@ db = Connection.new(host, port).db('ruby-mongo-examples') coll = db.collection('test') # Erase all records from collection, if any -coll.clear +coll.remove # Insert 3 records 3.times { |i| coll.insert({'a' => i+1}) } diff --git a/examples/info.rb b/examples/info.rb index c8fface..b532a3a 100644 --- a/examples/info.rb +++ b/examples/info.rb @@ -11,7 +11,7 @@ db = Connection.new(host, port).db('ruby-mongo-examples') coll = db.collection('test') # Erase all records from collection, if any -coll.clear +coll.remove # Insert 3 records 3.times { |i| coll.insert({'a' => i+1}) } diff --git a/examples/queries.rb b/examples/queries.rb index d9d92ff..44282ba 100644 --- a/examples/queries.rb +++ b/examples/queries.rb @@ -12,7 +12,7 @@ db = Connection.new(host, port).db('ruby-mongo-examples') coll = db.collection('test') # Remove all records, if any -coll.clear +coll.remove # Insert three records coll.insert('a' => 1) diff --git a/examples/simple.rb b/examples/simple.rb index 9004be1..269360b 100644 --- a/examples/simple.rb +++ b/examples/simple.rb @@ -11,7 +11,7 @@ db = Connection.new(host, port).db('ruby-mongo-examples') coll = db.collection('test') # Erase all records from collection, if any -coll.clear +coll.remove # Insert 3 records 3.times { |i| coll.insert({'a' => i+1}) } diff --git a/examples/types.rb b/examples/types.rb index dfdd798..ae10836 100644 --- a/examples/types.rb +++ b/examples/types.rb @@ -12,7 +12,7 @@ db = Connection.new(host, port).db('ruby-mongo-examples') coll = db.collection('test') # Remove all records, if any -coll.clear +coll.remove # Insert record with all sorts of values coll.insert('array' => [1, 2, 3], @@ -32,4 +32,4 @@ coll.insert('array' => [1, 2, 3], pp coll.find().next_document -coll.clear +coll.remove