Bumped patch version. Added more mongo-qa tests.
This commit is contained in:
parent
8ef393437c
commit
0c89a036d1
|
@ -1,6 +1,6 @@
|
|||
Gem::Specification.new do |s|
|
||||
s.name = 'mongo'
|
||||
s.version = '0.5.2'
|
||||
s.version = '0.5.3'
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.summary = 'Simple pure-Ruby driver for the 10gen Mongo DB'
|
||||
s.description = 'A pure-Ruby driver for the 10gen Mongo DB. For more information about Mongo, see http://www.mongodb.org.'
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
db.collection('test').insert({'test' => 1})
|
||||
|
||||
admin = db.admin
|
||||
|
||||
['test', 'pdlskwmf', '$'].each { |name|
|
||||
begin
|
||||
admin.validate_collection(name)
|
||||
puts 'true'
|
||||
rescue => ex
|
||||
puts 'false'
|
||||
end
|
||||
}
|
||||
|
||||
level_xlation = {:off => 'off', :all => 'all', :slow_only => 'slowOnly'}
|
||||
puts level_xlation[admin.profiling_level]
|
||||
admin.profiling_level = :off
|
||||
puts level_xlation[admin.profiling_level]
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
db.create_collection('capped1', :capped => true, :size => 500)
|
||||
coll = db.collection('capped1')
|
||||
coll.insert('x' => 1)
|
||||
coll.insert('x' => 2)
|
||||
|
||||
db.create_collection('capped2', :capped => true, :size => 1000, :max => 11)
|
||||
coll = db.collection('capped2')
|
||||
str = ''
|
||||
100.times {
|
||||
coll.insert('dashes' => str)
|
||||
str << '-'
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
cursor = db.collection('c').find({'x' => 1}, :sort => 'y', :offset => 20, :limit => 10)
|
||||
cursor.each { |row| puts row['z'] }
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
x = db.collection('x')
|
||||
y = db.collection('y')
|
||||
|
||||
def print_sorted_info_keys(info)
|
||||
puts info[:keys].keys.sort.collect { |key| "#{key}_1" }.join("_")
|
||||
end
|
||||
|
||||
x.drop_index('field1')
|
||||
x.index_information.each { |info| print_sorted_info_keys(info) }
|
||||
|
||||
y.create_index('abc', ['a', 'b', 'c'])
|
||||
y.create_index('d', ['d'])
|
||||
y.index_information.sort{|a,b| a[:name] <=> b[:name]}.each { |info| print_sorted_info_keys(info) }
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
LONG_STRING = "lksjhasoh1298alshasoidiohaskjasiouashoasasiugoas" * 6
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
c = db.collection('stress1')
|
||||
|
||||
50000.times { |i|
|
||||
c.insert(:name => "asdf#{i}", :date => Time.now, :_id => i,
|
||||
:blah => LONG_STRING, :subarray => [])
|
||||
}
|
||||
puts
|
||||
|
||||
10000.times { |i|
|
||||
cursor = c.find({:_id => i})
|
||||
x = cursor.next_object
|
||||
cursor.close
|
||||
x['subarray'] = "foo#{i}"
|
||||
c.insert(x)
|
||||
}
|
||||
puts
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
foo = db.collection('foo')
|
||||
|
||||
foo.update({:x => 1}, {:x => 1, :y => 2})
|
||||
foo.update({:x => 2}, {:x => 1, :y => 7})
|
||||
foo.update({:x => 3}, {:x => 4, :y => 1})
|
Loading…
Reference in New Issue