You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Though the pooling architecture will undoubtedly evolve, it currently owes much credit
170
170
to the connection pooling implementations in ActiveRecord and PyMongo.
@@ -177,13 +177,13 @@ of v1.3.0, the Ruby driver detects forking and reconnects automatically.
177
177
178
178
## Environment variable `MONGODB_URI`
179
179
180
-
`Mongo::Connection.from_uri`, `Mongo::Connection.new` and `Mongo::ReplSetConnection.new` will use <code>ENV["MONGODB_URI"]</code> if no other args are provided.
180
+
`Mongo::Client.from_uri`, `Mongo::Client.new` and `Mongo::ReplSetClient.new` will use <code>ENV["MONGODB_URI"]</code> if no other args are provided.
If the type of connection (direct or replica set) should be determined entirely from <code>ENV["MONGODB_URI"]</code>, you may want to use `Mongo::Connection.from_uri` because it will return either `Mongo::Connection` or a `Mongo::ReplSetConnection` depending on how many hosts are specified. Trying to use `Mongo::Connection.new` with multiple hosts in <code>ENV["MONGODB_URI"]</code> will raise an exception.
186
+
If the type of connection (direct or replica set) should be determined entirely from <code>ENV["MONGODB_URI"]</code>, you may want to use `Mongo::Client.from_uri` because it will return either `Mongo::Client` or a `Mongo::ReplSetClient` depending on how many hosts are specified. Trying to use `Mongo::Client.new` with multiple hosts in <code>ENV["MONGODB_URI"]</code> will raise an exception.
187
187
188
188
## String Encoding
189
189
@@ -213,9 +213,9 @@ generate _id values. If you want to control _id values or even their types,
213
213
using a PK factory lets you do so.
214
214
215
215
You can tell the Ruby Mongo driver how to create primary keys by passing in
216
-
the :pk option to the Connection#db method.
216
+
the :pk option to the Client#db method.
217
217
218
-
db = Mongo::Connection.new('localhost', 27017, :safe => true).db('dbname', :pk => MyPKFactory.new)
218
+
db = Mongo::Client.new('localhost', 27017, :safe => true).db('dbname', :pk => MyPKFactory.new)
219
219
220
220
A primary key factory object must respond to :create_pk, which should
221
221
take a hash and return a hash which merges the original hash with any
@@ -268,7 +268,7 @@ completely harmless; strict mode is a programmer convenience only.
268
268
To turn on strict mode, either pass in :strict => true when obtaining a DB
269
269
object or call the `:strict=` method:
270
270
271
-
db = Connection.new('localhost', 27017, :safe => true).db('dbname', :strict => true)
271
+
db = Client.new('localhost', 27017, :safe => true).db('dbname', :strict => true)
272
272
# I'm feeling lax
273
273
db.strict = false
274
274
# No, I'm not!
@@ -291,10 +291,10 @@ Notes:
291
291
## Socket timeouts
292
292
293
293
The Ruby driver support timeouts on socket read operations. To enable them, set the
294
-
`:op_timeout` option when you create a `Mongo::Connection` object.
294
+
`:op_timeout` option when you create a `Mongo::Client` object.
295
295
296
296
If implementing higher-level timeouts, using tools like `Rack::Timeout`, it's very important
297
-
to call `Mongo::Connection#close` to prevent the subsequent operation from receiving the previous
297
+
to call `Mongo::Client#close` to prevent the subsequent operation from receiving the previous
298
298
request.
299
299
300
300
### Test-Unit, Shoulda, and Mocha
@@ -306,7 +306,7 @@ Running the test suite requires test-unit, shoulda, and mocha. You can install
306
306
$ gem install mocha
307
307
308
308
The tests assume that the Mongo database is running on the default port. You
309
-
can override the default host (localhost) and port (Connection::DEFAULT_PORT) by
309
+
can override the default host (localhost) and port (Client::DEFAULT_PORT) by
310
310
using the environment variables MONGO_RUBY_DRIVER_HOST and
0 commit comments