API CHANGE: moving XGen::Mongo::Driver and XGen::Mongo to Mongo and XGen::Mongo::GridFS to GridFS
This commit is contained in:
parent
040ba7c9c2
commit
e65dd99667
18
README.rdoc
18
README.rdoc
@ -7,9 +7,9 @@ many more.
|
||||
|
||||
require 'mongo'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
db = Mongo.new('localhost').db('sample-db')
|
||||
db = Mongo::Mongo.new('localhost').db('sample-db')
|
||||
coll = db.collection('test')
|
||||
|
||||
coll.clear
|
||||
@ -79,8 +79,8 @@ Here is some simple example code:
|
||||
require 'rubygems' # not required for Ruby 1.9
|
||||
require 'mongo'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
db = Mongo.new.db('my-db-name')
|
||||
include Mongo
|
||||
db = Mongo::Mongo.new.db('my-db-name')
|
||||
things = db.collection('things')
|
||||
|
||||
things.clear
|
||||
@ -149,8 +149,8 @@ using a PK factory lets you do so.
|
||||
You can tell the Ruby Mongo driver how to create primary keys by passing in
|
||||
the :pk option to the Mongo#db method.
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
db = Mongo.new.db('dbname', :pk => MyPKFactory.new)
|
||||
include Mongo
|
||||
db = Mongo::Mongo.new.db('dbname', :pk => MyPKFactory.new)
|
||||
|
||||
A primary key factory object must respond to :create_pk, which should take a
|
||||
hash and return a hash which merges the original hash with any primary key
|
||||
@ -164,7 +164,7 @@ Here is a sample primary key factory, taken from the tests:
|
||||
|
||||
class TestPKFactory
|
||||
def create_pk(row)
|
||||
row['_id'] ||= XGen::Mongo::Driver::ObjectID.new
|
||||
row['_id'] ||= Mongo::ObjectID.new
|
||||
row
|
||||
end
|
||||
end
|
||||
@ -178,7 +178,7 @@ ActiveRecord-like framework for non-Rails apps) and the AR Mongo adapter code
|
||||
def create_pk(row)
|
||||
return row if row[:_id]
|
||||
row.delete(:_id) # in case it exists but the value is nil
|
||||
row['_id'] ||= XGen::Mongo::Driver::ObjectID.new
|
||||
row['_id'] ||= Mongo::ObjectID.new
|
||||
row
|
||||
end
|
||||
end
|
||||
@ -205,7 +205,7 @@ completely harmless; strict mode is a programmer convenience only.
|
||||
To turn on strict mode, either pass in :strict => true when obtaining a DB
|
||||
object or call the :strict= method:
|
||||
|
||||
db = XGen::Mongo::Driver::Mongo.new.db('dbname', :strict => true)
|
||||
db = Mongo::Mongo.new.db('dbname', :strict => true)
|
||||
# I'm feeling lax
|
||||
db.strict = false
|
||||
# No, I'm not!
|
||||
|
@ -3,7 +3,7 @@
|
||||
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
TRIALS = 100000
|
||||
|
||||
|
@ -7,14 +7,14 @@ require 'irb'
|
||||
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
host = org_argv[0] || ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = org_argv[1] || ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = org_argv[1] || ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
dbnm = org_argv[2] || ENV['MONGO_RUBY_DRIVER_DB'] || 'ruby-mongo-console'
|
||||
|
||||
puts "Connecting to #{host}:#{port} (CONN) on with database #{dbnm} (DB)"
|
||||
CONN = Mongo.new(host, port)
|
||||
CONN = Mongo::Mongo.new(host, port)
|
||||
DB = CONN.db(dbnm)
|
||||
|
||||
puts "Starting IRB session..."
|
||||
|
@ -5,7 +5,7 @@
|
||||
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
TRIALS = 2
|
||||
PER_TRIAL = 5000
|
||||
@ -50,9 +50,9 @@ def benchmark(str, proc, n, db, coll_name, object, setup=nil)
|
||||
end
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
connection = Mongo.new(host, port)
|
||||
connection = Mongo::Mongo.new(host, port)
|
||||
connection.drop_database("benchmark")
|
||||
db = connection.db('benchmark')
|
||||
|
||||
|
@ -2,13 +2,13 @@ $LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
require 'pp'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts "Connecting to #{host}:#{port}"
|
||||
db = Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
db = Mongo::Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
coll = db.create_collection('test')
|
||||
|
||||
# Erase all records from collection, if any
|
||||
|
@ -4,10 +4,10 @@ $LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts "Connecting to #{host}:#{port}"
|
||||
db = XGen::Mongo::Driver::Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
db = Mongo::Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
coll = db.collection('test')
|
||||
coll.clear
|
||||
|
||||
|
@ -9,13 +9,13 @@ end
|
||||
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts ">> Connecting to #{host}:#{port}"
|
||||
DB = Mongo.new(host, port).db('ruby-mongo-blog')
|
||||
DB = Mongo::Mongo.new(host, port).db('ruby-mongo-blog')
|
||||
|
||||
LINE_SIZE = 120
|
||||
puts "=" * LINE_SIZE
|
||||
|
@ -1,13 +1,13 @@
|
||||
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts "Connecting to #{host}:#{port}"
|
||||
db = Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
db = Mongo::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.
|
||||
|
@ -2,13 +2,13 @@ $LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
require 'pp'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts "Connecting to #{host}:#{port}"
|
||||
db = Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
db = Mongo::Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
coll = db.collection('test')
|
||||
|
||||
# Erase all records from collection, if any
|
||||
|
@ -2,14 +2,14 @@ $LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
require 'mongo/gridfs'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include XGen::Mongo::GridFS
|
||||
include Mongo
|
||||
include GridFS
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts "Connecting to #{host}:#{port}"
|
||||
db = Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
db = Mongo::Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
|
||||
def dump(db, fname)
|
||||
GridStore.open(db, fname, 'r') { |f| puts f.read }
|
||||
|
@ -7,13 +7,13 @@ end
|
||||
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts ">> Connecting to #{host}:#{port}"
|
||||
db = Mongo.new(host, port).db('ruby-mongo-index_test')
|
||||
db = Mongo::Mongo.new(host, port).db('ruby-mongo-index_test')
|
||||
|
||||
puts ">> Dropping collection test"
|
||||
begin
|
||||
@ -76,7 +76,7 @@ end
|
||||
|
||||
puts ">> Dropping index"
|
||||
begin
|
||||
res = coll.drop_index "all"
|
||||
res = coll.drop_index "all_1"
|
||||
puts "dropped : #{res.inspect}"
|
||||
rescue => e
|
||||
puts "Error: #{e.errmsg}"
|
||||
|
@ -1,13 +1,13 @@
|
||||
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts "Connecting to #{host}:#{port}"
|
||||
db = Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
db = Mongo::Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
coll = db.collection('test')
|
||||
|
||||
# Erase all records from collection, if any
|
||||
|
@ -2,13 +2,13 @@ $LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
require 'pp'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts "Connecting to #{host}:#{port}"
|
||||
db = Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
db = Mongo::Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
coll = db.collection('test')
|
||||
|
||||
# Remove all records, if any
|
||||
|
@ -1,13 +1,13 @@
|
||||
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts "Connecting to #{host}:#{port}"
|
||||
db = Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
db = Mongo::Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
coll = db.collection('test')
|
||||
|
||||
# Erase all records from collection, if any
|
||||
|
@ -1,13 +1,13 @@
|
||||
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts "Connecting to #{host}:#{port}"
|
||||
db = Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
db = Mongo::Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
|
||||
db.drop_collection('does-not-exist')
|
||||
db.create_collection('test')
|
||||
|
@ -2,13 +2,13 @@ $LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
||||
require 'mongo'
|
||||
require 'pp'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
||||
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
|
||||
|
||||
puts "Connecting to #{host}:#{port}"
|
||||
db = Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
db = Mongo::Mongo.new(host, port).db('ruby-mongo-examples')
|
||||
coll = db.collection('test')
|
||||
|
||||
# Remove all records, if any
|
||||
@ -25,13 +25,8 @@ coll.insert('array' => [1, 2, 3],
|
||||
'float' => 33.33333,
|
||||
'regex' => /foobar/i,
|
||||
'boolean' => true,
|
||||
'$where' => Code.new('this.x == 3'),
|
||||
'where' => Code.new('this.x == 3'),
|
||||
'dbref' => DBRef.new(coll.name, ObjectID.new),
|
||||
|
||||
# NOTE: the undefined type is not saved to the database properly. This is a
|
||||
# Mongo bug. However, the undefined type may go away completely.
|
||||
# 'undef' => Undefined.new,
|
||||
|
||||
'null' => nil,
|
||||
'symbol' => :zildjian)
|
||||
|
||||
|
@ -275,7 +275,7 @@ static int write_element_allow_id(VALUE key, VALUE value, VALUE extra, int allow
|
||||
case T_STRING:
|
||||
{
|
||||
if (strcmp(rb_class2name(RBASIC(value)->klass),
|
||||
"XGen::Mongo::Driver::Code") == 0) {
|
||||
"Mongo::Code") == 0) {
|
||||
int start_position, length_location, length, total_length;
|
||||
write_name_and_type(buffer, key, 0x0F);
|
||||
|
||||
@ -314,7 +314,7 @@ static int write_element_allow_id(VALUE key, VALUE value, VALUE extra, int allow
|
||||
{
|
||||
// TODO there has to be a better way to do these checks...
|
||||
const char* cls = rb_class2name(RBASIC(value)->klass);
|
||||
if (strcmp(cls, "XGen::Mongo::Driver::Binary") == 0 ||
|
||||
if (strcmp(cls, "Mongo::Binary") == 0 ||
|
||||
strcmp(cls, "ByteBuffer") == 0) {
|
||||
const char subtype = strcmp(cls, "ByteBuffer") ?
|
||||
(const char)FIX2INT(rb_funcall(value, rb_intern("subtype"), 0)) : 2;
|
||||
@ -333,7 +333,7 @@ static int write_element_allow_id(VALUE key, VALUE value, VALUE extra, int allow
|
||||
buffer_write_bytes(buffer, RSTRING_PTR(string_data), length);
|
||||
break;
|
||||
}
|
||||
if (strcmp(cls, "XGen::Mongo::Driver::ObjectID") == 0) {
|
||||
if (strcmp(cls, "Mongo::ObjectID") == 0) {
|
||||
VALUE as_array = rb_funcall(value, rb_intern("to_a"), 0);
|
||||
int i;
|
||||
write_name_and_type(buffer, key, 0x07);
|
||||
@ -343,7 +343,7 @@ static int write_element_allow_id(VALUE key, VALUE value, VALUE extra, int allow
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (strcmp(cls, "XGen::Mongo::Driver::DBRef") == 0) {
|
||||
if (strcmp(cls, "Mongo::DBRef") == 0) {
|
||||
int start_position, length_location, obj_length;
|
||||
VALUE ns, oid;
|
||||
write_name_and_type(buffer, key, 0x03);
|
||||
@ -364,7 +364,7 @@ static int write_element_allow_id(VALUE key, VALUE value, VALUE extra, int allow
|
||||
memcpy(buffer->buffer + length_location, &obj_length, 4);
|
||||
break;
|
||||
}
|
||||
if (strcmp(cls, "XGen::Mongo::Driver::Undefined") == 0) {
|
||||
if (strcmp(cls, "Mongo::Undefined") == 0) {
|
||||
write_name_and_type(buffer, key, 0x0A); // just use nil type
|
||||
break;
|
||||
}
|
||||
@ -736,25 +736,22 @@ static VALUE method_deserialize(VALUE self, VALUE bson) {
|
||||
}
|
||||
|
||||
void Init_cbson() {
|
||||
VALUE driver, CBson;
|
||||
VALUE mongo, CBson;
|
||||
Time = rb_const_get(rb_cObject, rb_intern("Time"));
|
||||
|
||||
driver = rb_const_get(rb_const_get(rb_const_get(rb_cObject,
|
||||
rb_intern("XGen")),
|
||||
rb_intern("Mongo")),
|
||||
rb_intern("Driver"));
|
||||
mongo = rb_const_get(rb_cObject, rb_intern("Mongo"));
|
||||
rb_require("mongo/types/binary");
|
||||
Binary = rb_const_get(driver, rb_intern("Binary"));
|
||||
Binary = rb_const_get(mongo, rb_intern("Binary"));
|
||||
rb_require("mongo/types/objectid");
|
||||
ObjectID = rb_const_get(driver, rb_intern("ObjectID"));
|
||||
ObjectID = rb_const_get(mongo, rb_intern("ObjectID"));
|
||||
rb_require("mongo/types/dbref");
|
||||
DBRef = rb_const_get(driver, rb_intern("DBRef"));
|
||||
DBRef = rb_const_get(mongo, rb_intern("DBRef"));
|
||||
rb_require("mongo/types/code");
|
||||
Code = rb_const_get(driver, rb_intern("Code"));
|
||||
Code = rb_const_get(mongo, rb_intern("Code"));
|
||||
rb_require("mongo/types/regexp_of_holding");
|
||||
RegexpOfHolding = rb_const_get(driver, rb_intern("RegexpOfHolding"));
|
||||
RegexpOfHolding = rb_const_get(mongo, rb_intern("RegexpOfHolding"));
|
||||
rb_require("mongo/errors");
|
||||
InvalidName = rb_const_get(driver, rb_intern("InvalidName"));
|
||||
InvalidName = rb_const_get(mongo, rb_intern("InvalidName"));
|
||||
rb_require("mongo/util/ordered_hash");
|
||||
OrderedHash = rb_const_get(rb_cObject, rb_intern("OrderedHash"));
|
||||
|
||||
|
@ -12,9 +12,7 @@ require 'mongo/cursor'
|
||||
require 'mongo/collection'
|
||||
require 'mongo/admin'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
ASCENDING = 1
|
||||
DESCENDING = -1
|
||||
end
|
||||
end
|
||||
|
@ -16,9 +16,7 @@
|
||||
|
||||
require 'mongo/util/ordered_hash'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
# Provide administrative database methods: those having to do with
|
||||
# profiling and validation.
|
||||
@ -83,5 +81,3 @@ module XGen
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -16,9 +16,7 @@
|
||||
|
||||
require 'mongo/query'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
# A named collection of records in a database.
|
||||
class Collection
|
||||
@ -275,7 +273,7 @@ module XGen
|
||||
# Create a new index. +field_or_spec+
|
||||
# should be either a single field name or a Array of [field name,
|
||||
# direction] pairs. Directions should be specified as
|
||||
# XGen::Mongo::ASCENDING or XGen::Mongo::DESCENDING.
|
||||
# Mongo::ASCENDING or Mongo::DESCENDING.
|
||||
# +unique+ is an optional boolean indicating whether this index
|
||||
# should enforce a uniqueness constraint.
|
||||
def create_index(field_or_spec, unique=false)
|
||||
@ -436,6 +434,3 @@ EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -18,9 +18,7 @@ require 'mongo/message'
|
||||
require 'mongo/util/byte_buffer'
|
||||
require 'mongo/util/bson'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
# A cursor over query results. Returned objects are hashes.
|
||||
class Cursor
|
||||
@ -245,5 +243,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -23,9 +23,7 @@ require 'mongo/query'
|
||||
require 'mongo/util/ordered_hash.rb'
|
||||
require 'mongo/admin'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
# A Mongo database.
|
||||
class DB
|
||||
@ -461,7 +459,7 @@ module XGen
|
||||
# Create a new index on +collection_name+. +field_or_spec+
|
||||
# should be either a single field name or a Array of [field name,
|
||||
# direction] pairs. Directions should be specified as
|
||||
# XGen::Mongo::ASCENDING or XGen::Mongo::DESCENDING. Normally called
|
||||
# Mongo::ASCENDING or Mongo::DESCENDING. Normally called
|
||||
# by Collection#create_index. If +unique+ is true the index will
|
||||
# enforce a uniqueness constraint.
|
||||
def create_index(collection_name, field_or_spec, unique=false)
|
||||
@ -560,5 +558,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -14,14 +14,10 @@
|
||||
|
||||
# Exceptions raised by the MongoDB driver.
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
# Raised when a database operation fails.
|
||||
class OperationFailure < RuntimeError; end
|
||||
|
||||
# Raised when an invalid name is used.
|
||||
class InvalidName < RuntimeError; end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -19,8 +19,6 @@ require 'mongo/util/byte_buffer'
|
||||
require 'mongo/util/ordered_hash'
|
||||
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module GridFS
|
||||
|
||||
# A chunk stores a portion of GridStore data.
|
||||
@ -33,7 +31,7 @@ module XGen
|
||||
|
||||
def initialize(file, mongo_object={})
|
||||
@file = file
|
||||
@object_id = mongo_object['_id'] || XGen::Mongo::Driver::ObjectID.new
|
||||
@object_id = mongo_object['_id'] || Mongo::ObjectID.new
|
||||
@chunk_number = mongo_object['n'] || 0
|
||||
|
||||
@data = ByteBuffer.new
|
||||
@ -92,5 +90,3 @@ module XGen
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -18,8 +18,6 @@ require 'mongo/types/objectid'
|
||||
require 'mongo/util/ordered_hash'
|
||||
require 'mongo/gridfs/chunk'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module GridFS
|
||||
|
||||
# GridStore is an IO-like object that provides input and output for
|
||||
@ -158,7 +156,7 @@ module XGen
|
||||
@metadata = doc['metadata']
|
||||
@md5 = doc['md5']
|
||||
else
|
||||
@files_id = XGen::Mongo::Driver::ObjectID.new
|
||||
@files_id = Mongo::ObjectID.new
|
||||
@content_type = DEFAULT_CONTENT_TYPE
|
||||
@chunk_size = Chunk::DEFAULT_CHUNK_SIZE
|
||||
@length = 0
|
||||
@ -169,7 +167,7 @@ module XGen
|
||||
@curr_chunk = nth_chunk(0)
|
||||
@position = 0
|
||||
when 'w'
|
||||
chunk_collection.create_index([['files_id', XGen::Mongo::ASCENDING], ['n', XGen::Mongo::ASCENDING]])
|
||||
chunk_collection.create_index([['files_id', Mongo::ASCENDING], ['n', Mongo::ASCENDING]])
|
||||
delete_chunks
|
||||
@curr_chunk = Chunk.new(self, 'n' => 0)
|
||||
@content_type = options[:content_type] if options[:content_type]
|
||||
@ -177,7 +175,7 @@ module XGen
|
||||
@metadata = options[:metadata] if options[:metadata]
|
||||
@position = 0
|
||||
when 'w+'
|
||||
chunk_collection.create_index([['files_id', XGen::Mongo::ASCENDING], ['n', XGen::Mongo::ASCENDING]])
|
||||
chunk_collection.create_index([['files_id', Mongo::ASCENDING], ['n', Mongo::ASCENDING]])
|
||||
@curr_chunk = nth_chunk(last_chunk_number) || Chunk.new(self, 'n' => 0) # might be empty
|
||||
@curr_chunk.pos = @curr_chunk.data.length if @curr_chunk
|
||||
@metadata = options[:metadata] if options[:metadata]
|
||||
@ -464,5 +462,3 @@ module XGen
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -17,9 +17,7 @@
|
||||
require 'mongo/message/message'
|
||||
require 'mongo/message/opcodes'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
class GetMoreMessage < Message
|
||||
|
||||
@ -32,6 +30,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
require 'mongo/message/message'
|
||||
require 'mongo/message/opcodes'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
class InsertMessage < Message
|
||||
|
||||
@ -31,5 +29,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -17,9 +17,7 @@
|
||||
require 'mongo/message/message'
|
||||
require 'mongo/message/opcodes'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
class KillCursorsMessage < Message
|
||||
|
||||
@ -31,6 +29,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
require 'mongo/util/bson'
|
||||
require 'mongo/util/byte_buffer'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
class Message
|
||||
|
||||
@ -80,5 +78,3 @@ module XGen
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -16,9 +16,7 @@
|
||||
|
||||
require 'mongo/util/byte_buffer'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
class MessageHeader
|
||||
|
||||
@ -45,6 +43,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
require 'mongo/message/message'
|
||||
require 'mongo/message/opcodes'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
class MsgMessage < Message
|
||||
|
||||
@ -29,5 +27,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -14,9 +14,7 @@
|
||||
# limitations under the License.
|
||||
# ++
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
OP_REPLY = 1 # reply. responseTo is set.
|
||||
OP_MSG = 1000 # generic msg command followed by a string
|
||||
OP_UPDATE = 2001 # update object
|
||||
@ -27,6 +25,3 @@ module XGen
|
||||
OP_DELETE = 2006
|
||||
OP_KILL_CURSORS = 2007
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -18,9 +18,7 @@ require 'mongo/message/message'
|
||||
require 'mongo/message/opcodes'
|
||||
require 'mongo/util/ordered_hash'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
class QueryMessage < Message
|
||||
|
||||
@ -73,5 +71,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -17,9 +17,7 @@
|
||||
require 'mongo/message/message'
|
||||
require 'mongo/message/opcodes'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
class RemoveMessage < Message
|
||||
|
||||
@ -32,5 +30,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -17,9 +17,7 @@
|
||||
require 'mongo/message/message'
|
||||
require 'mongo/message/opcodes'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
class UpdateMessage < Message
|
||||
|
||||
@ -33,5 +31,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -16,9 +16,7 @@
|
||||
|
||||
require 'mongo/db'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
# Represents a Mongo database server.
|
||||
class Mongo
|
||||
@ -87,11 +85,11 @@ module XGen
|
||||
@options = options
|
||||
end
|
||||
|
||||
# Return the XGen::Mongo::Driver::DB named +db_name+. The slave_ok and
|
||||
# Return the Mongo::DB named +db_name+. The slave_ok and
|
||||
# auto_reconnect options passed in via #new may be overridden here.
|
||||
# See DB#new for other options you can pass in.
|
||||
def db(db_name, options={})
|
||||
XGen::Mongo::Driver::DB.new(db_name, @pair, @options.merge(options))
|
||||
DB.new(db_name, @pair, @options.merge(options))
|
||||
end
|
||||
|
||||
# Returns a hash containing database names as keys and disk space for
|
||||
@ -159,6 +157,3 @@ module XGen
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -18,9 +18,7 @@ require 'mongo/collection'
|
||||
require 'mongo/message'
|
||||
require 'mongo/types/code'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
# A query against a collection. A query's selector is a hash. See the
|
||||
# Mongo documentation for query details.
|
||||
@ -115,5 +113,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -16,9 +16,7 @@
|
||||
|
||||
require 'mongo/util/byte_buffer'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
# An array of binary bytes with a Mongo subtype value.
|
||||
class Binary < ByteBuffer
|
||||
@ -38,5 +36,3 @@ module XGen
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -14,9 +14,7 @@
|
||||
# limitations under the License.
|
||||
# ++
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
# JavaScript code to be evaluated by MongoDB
|
||||
class Code < String
|
||||
@ -30,5 +28,3 @@ module XGen
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -14,9 +14,7 @@
|
||||
# limitations under the License.
|
||||
# ++
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
class DBRef
|
||||
|
||||
@ -33,5 +31,3 @@ module XGen
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -17,9 +17,7 @@
|
||||
require 'mutex_m'
|
||||
require 'mongo/util/byte_buffer'
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
# Implementation of the Babble OID. Object ids are not required by
|
||||
# Mongo, but they make certain operations more efficient.
|
||||
@ -133,5 +131,3 @@ module XGen
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -14,9 +14,7 @@
|
||||
# limitations under the License.
|
||||
# ++
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
# A Regexp that can hold on to extra options and ignore them. Mongo
|
||||
# regexes may contain option characters beyond 'i', 'm', and 'x'. (Note
|
||||
@ -40,5 +38,3 @@ module XGen
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -14,9 +14,7 @@
|
||||
# limitations under the License.
|
||||
# ++
|
||||
|
||||
module XGen
|
||||
module Mongo
|
||||
module Driver
|
||||
|
||||
# DEPRECATED - the ruby driver converts the BSON undefined type to nil,
|
||||
# and saves this type as nil
|
||||
@ -28,5 +26,3 @@ module XGen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ require 'mongo/types/undefined'
|
||||
# A BSON seralizer/deserializer.
|
||||
class BSON
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
MINKEY = -1
|
||||
EOO = 0
|
||||
|
@ -21,7 +21,7 @@ require 'mongo'
|
||||
# an OrderedHash.
|
||||
class XMLToRuby
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
def xml_to_ruby(io)
|
||||
doc = REXML::Document.new(io)
|
||||
|
@ -5,4 +5,4 @@ DEFAULT_HOST = '127.0.0.1'
|
||||
DEFAULT_PORT = 27017
|
||||
DEFAULT_DB = 'driver_test_framework'
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
@ -3,9 +3,9 @@
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
|
||||
require 'mongo/gridfs'
|
||||
include XGen::Mongo::GridFS
|
||||
include GridFS
|
||||
|
||||
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
db = Mongo::Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
input_file = ARGV[0]
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
|
||||
require 'mongo/gridfs'
|
||||
include XGen::Mongo::GridFS
|
||||
include GridFS
|
||||
|
||||
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
db = Mongo::Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
input_file = ARGV[0]
|
||||
output_file = ARGV[1]
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
|
||||
include XGen::Mongo
|
||||
include Mongo
|
||||
|
||||
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
db = Mongo::Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
x = db.collection('x')
|
||||
y = db.collection('y')
|
||||
|
||||
|
@ -5,7 +5,7 @@ require 'test/unit'
|
||||
# NOTE: assumes Mongo is running
|
||||
class AdminTest < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
@@db = Mongo.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
|
||||
ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::DEFAULT_PORT).db('ruby-mongo-test')
|
||||
|
@ -5,7 +5,7 @@ require 'test/unit'
|
||||
|
||||
class BSONTest < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
def setup
|
||||
# We don't pass a DB to the constructor, even though we are about to test
|
||||
@ -85,7 +85,7 @@ class BSONTest < Test::Unit::TestCase
|
||||
assert_equal doc, doc2
|
||||
|
||||
r = doc2['doc']
|
||||
assert_kind_of XGen::Mongo::Driver::RegexpOfHolding, r
|
||||
assert_kind_of RegexpOfHolding, r
|
||||
assert_equal '', r.extra_options_str
|
||||
|
||||
r.extra_options_str << 'zywcab'
|
||||
@ -99,7 +99,7 @@ class BSONTest < Test::Unit::TestCase
|
||||
assert_equal doc, doc2
|
||||
|
||||
r = doc2['doc']
|
||||
assert_kind_of XGen::Mongo::Driver::RegexpOfHolding, r
|
||||
assert_kind_of RegexpOfHolding, r
|
||||
assert_equal 'abcwyz', r.extra_options_str # must be sorted
|
||||
end
|
||||
|
||||
|
@ -5,8 +5,8 @@ require 'mongo/gridfs'
|
||||
|
||||
class ChunkTest < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include XGen::Mongo::GridFS
|
||||
include Mongo
|
||||
include GridFS
|
||||
|
||||
@@db = Mongo.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
|
||||
ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::DEFAULT_PORT).db('ruby-mongo-utils-test')
|
||||
|
@ -20,8 +20,7 @@ require 'test/unit'
|
||||
|
||||
# NOTE: assumes Mongo is running
|
||||
class TestCollection < Test::Unit::TestCase
|
||||
include XGen::Mongo
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
@@db = Mongo.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
|
||||
ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::DEFAULT_PORT).db('ruby-mongo-test')
|
||||
|
@ -5,7 +5,7 @@ require 'test/unit'
|
||||
# NOTE: assumes Mongo is running
|
||||
class CursorTest < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
@@db = Mongo.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
|
||||
ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::DEFAULT_PORT).db('ruby-mongo-test')
|
||||
|
@ -5,7 +5,7 @@ require 'test/unit'
|
||||
|
||||
class TestPKFactory
|
||||
def create_pk(row)
|
||||
row['_id'] ||= XGen::Mongo::Driver::ObjectID.new
|
||||
row['_id'] ||= Mongo::ObjectID.new
|
||||
row
|
||||
end
|
||||
end
|
||||
@ -13,7 +13,7 @@ end
|
||||
# NOTE: assumes Mongo is running
|
||||
class DBTest < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
@@host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
@@port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::DEFAULT_PORT
|
||||
@ -85,7 +85,7 @@ class DBTest < Test::Unit::TestCase
|
||||
assert_not_nil oid
|
||||
assert_equal insert_id, oid
|
||||
|
||||
oid = XGen::Mongo::Driver::ObjectID.new
|
||||
oid = ObjectID.new
|
||||
data = {'_id' => oid, 'name' => 'Barney', 'age' => 41}
|
||||
coll.insert(data)
|
||||
row = coll.find_one({'name' => data['name']})
|
||||
|
@ -4,8 +4,7 @@ require 'test/unit'
|
||||
|
||||
# NOTE: assumes Mongo is running
|
||||
class DBAPITest < Test::Unit::TestCase
|
||||
include XGen::Mongo
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
@@db = Mongo.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
|
||||
ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::DEFAULT_PORT).db('ruby-mongo-test')
|
||||
@ -817,18 +816,4 @@ class DBAPITest < Test::Unit::TestCase
|
||||
@@db.collection("test").find({}, :snapshot => true, :sort => 'a').to_a
|
||||
end
|
||||
end
|
||||
|
||||
# TODO this test fails with error message "Undefed Before end of object"
|
||||
# That is a database error. The undefined type may go away.
|
||||
|
||||
# def test_insert_undefined
|
||||
# doc = {'undef' => Undefined.new}
|
||||
# @@coll.clear
|
||||
# @@coll.insert(doc)
|
||||
# p @@db.error # DEBUG
|
||||
# assert_equal 1, @@coll.count
|
||||
# row = @@coll.find().next_object
|
||||
# assert_not_nil row
|
||||
# end
|
||||
|
||||
end
|
||||
|
@ -5,7 +5,7 @@ require 'test/unit'
|
||||
# NOTE: assumes Mongo is running
|
||||
class DBConnectionTest < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
def test_no_exceptions
|
||||
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
|
@ -5,8 +5,8 @@ require 'mongo/gridfs'
|
||||
|
||||
class GridStoreTest < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include XGen::Mongo::GridFS
|
||||
include Mongo
|
||||
include GridFS
|
||||
|
||||
@@db = Mongo.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
|
||||
ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::DEFAULT_PORT).db('ruby-mongo-test')
|
||||
|
@ -4,7 +4,7 @@ require 'test/unit'
|
||||
|
||||
class MessageTest < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
def setup
|
||||
@msg = Message.new(42)
|
||||
|
@ -5,7 +5,7 @@ require 'test/unit'
|
||||
# NOTE: assumes Mongo is running
|
||||
class MongoTest < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
def setup
|
||||
@host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
|
@ -4,7 +4,7 @@ require 'test/unit'
|
||||
|
||||
class ObjectIDTest < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
def setup
|
||||
@t = 42
|
||||
|
@ -13,7 +13,7 @@ require 'test/unit'
|
||||
# of this project), then we find the BSON test files there and use those, too.
|
||||
class RoundTripTest < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
@@ruby = nil
|
||||
|
||||
|
@ -4,7 +4,7 @@ require 'test/unit'
|
||||
|
||||
class TestThreading < Test::Unit::TestCase
|
||||
|
||||
include XGen::Mongo::Driver
|
||||
include Mongo
|
||||
|
||||
@@host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
||||
@@port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::DEFAULT_PORT
|
||||
|
Loading…
Reference in New Issue
Block a user