Skip to content

Commit 44c7145

Browse files
committed
fixed deprecated api in examples
1 parent 990c00b commit 44c7145

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

examples/admin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
coll = db.create_collection('test')
1313

1414
# Erase all records from collection, if any
15-
coll.clear
15+
coll.remove
1616

1717
admin = db.admin
1818

examples/benchmarks.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
puts "Connecting to #{host}:#{port}"
1010
db = Mongo::Connection.new(host, port).db('ruby-mongo-examples')
1111
coll = db.collection('test')
12-
coll.clear
12+
coll.remove
1313

1414
OBJS_COUNT = 100
1515
TEST_COUNT = 100
@@ -22,13 +22,13 @@
2222
Benchmark.bmbm do |results|
2323
results.report("single object inserts: ") {
2424
TEST_COUNT.times {
25-
coll.clear
25+
coll.remove
2626
arr.each {|x| coll.insert(x)}
2727
}
2828
}
2929
results.report("multiple object insert: ") {
3030
TEST_COUNT.times {
31-
coll.clear
31+
coll.remove
3232
coll.insert(arr)
3333
}
3434
}
@@ -39,4 +39,4 @@
3939
}
4040
end
4141

42-
coll.clear
42+
coll.remove

examples/blog.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def errmsg
2121
puts "=" * LINE_SIZE
2222
puts "Adding authors"
2323
authors = DB.collection "authors"
24-
authors.clear
24+
authors.remove
2525
authors.create_index "meta", '_id' => 1, 'name' => 1, 'age' => 1
2626
puts "-" * LINE_SIZE
2727
shaksp = authors << { :name => "William Shakespeare", :email => "william@shakespeare.com", :age => 587 }
@@ -36,7 +36,7 @@ def errmsg
3636
puts "=" * LINE_SIZE
3737
puts "Adding users"
3838
users = DB.collection "users"
39-
users.clear
39+
users.remove
4040
# users.create_index "meta", :_id => 1, :login => 1, :name => 1
4141
puts "-" * LINE_SIZE
4242
jdoe = users << { :login => "jdoe", :name => "John Doe", :email => "john@doe.com" }
@@ -51,7 +51,7 @@ def errmsg
5151
puts "=" * LINE_SIZE
5252
puts "Adding articles"
5353
articles = DB.collection "articles"
54-
articles.clear
54+
articles.remove
5555
# articles.create_index "meta", :_id => 1, :author_id => 1, :title => 1
5656
puts "-" * LINE_SIZE
5757
begin

examples/cursor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
coll = db.collection('test')
1313

1414
# Erase all records from collection, if any
15-
coll.clear
15+
coll.remove
1616

1717
# Insert 3 records
1818
3.times { |i| coll.insert({'a' => i+1}) }

examples/info.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
coll = db.collection('test')
1212

1313
# Erase all records from collection, if any
14-
coll.clear
14+
coll.remove
1515

1616
# Insert 3 records
1717
3.times { |i| coll.insert({'a' => i+1}) }

examples/queries.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
coll = db.collection('test')
1313

1414
# Remove all records, if any
15-
coll.clear
15+
coll.remove
1616

1717
# Insert three records
1818
coll.insert('a' => 1)

examples/simple.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
coll = db.collection('test')
1212

1313
# Erase all records from collection, if any
14-
coll.clear
14+
coll.remove
1515

1616
# Insert 3 records
1717
3.times { |i| coll.insert({'a' => i+1}) }

examples/types.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
coll = db.collection('test')
1313

1414
# Remove all records, if any
15-
coll.clear
15+
coll.remove
1616

1717
# Insert record with all sorts of values
1818
coll.insert('array' => [1, 2, 3],
@@ -32,4 +32,4 @@
3232

3333
pp coll.find().next_document
3434

35-
coll.clear
35+
coll.remove

0 commit comments

Comments
 (0)