Browse files

minor: docs

  • Loading branch information...
1 parent 04033bf commit 0d90338a46a0ede7095c885188acccac89e30203 @banker banker committed Feb 10, 2011
Showing with 19 additions and 3 deletions.
  1. +15 −3
  2. +4 −0 docs/
@@ -129,7 +129,7 @@ The driver is thread-safe.
## Connection Pooling
-As of v0.18, the driver implements connection pooling. By default, only one
+The driver implements connection pooling. By default, only one
socket connection will be opened to MongoDB. However, if you're running a
multi-threaded application, you can specify a maximum pool size and a maximum
timeout for waiting for old connections to be released to the pool.
@@ -149,12 +149,24 @@ processes will create a new connection to the database. In Passenger, this can b
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
- # Create new connection here
+ # Reset all connection objects. How you do this depends on where
+ # you keep your connection object. In any case, call the #connect
+ # method on the connection object. For example:
+ # CONN.connect
+ #
+ # If you're using MongoMapper:
+ # MongoMapper.connection.connect
-The above code should be put into a Rails initializer or other initialization script.
+In Unicorn, add this to your unicorn.rb file:
+ after_fork do |server, worker|
+ # Handle reconnection
+ end
+The above code should be put into a Rails initializer or similar initialization script.
## String Encoding
@@ -110,3 +110,7 @@ Without further investigation, it's impossible to know exactly what has caused t
Because of the indeterminacy involved, the MongoDB drivers will not retry operations on connection failure. How connection failures should be handled is entirely dependent on the application. Therefore, we leave it to the application developers to make the best decision in this case.
The drivers will reconnect on the subsequent operation.
+#### I ocassionally get an error saying that responses are out of order. What's happening?
+See (this JIRA issue)[].

0 comments on commit 0d90338

Please sign in to comment.