-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 5.1.0
-
Component/s: None
-
None
Every time I query a Mongo document a new authentication is being created. I'm doing this from my rails console.
For example: Search.count
Returns:
MONGODB | ds051371-a0.mongolab.com:51371 | myapp.getnonce | STARTED | {}
MONGODB | ds051371-a0.mongolab.com:51371 | myapp.getnonce | SUCCEEDED | 0.001041145s
MONGODB | ds051371-a0.mongolab.com:51371 | myapp.authenticate | STARTED | {}
MONGODB | ds051371-a0.mongolab.com:51371 | myapp.authenticate | SUCCEEDED | 0.000993972s
MONGODB | ds051371-a0.mongolab.com:51371 | myapp.count | STARTED | {"count"=>"mongo_searches", "query"=>{}}
MONGODB | ds051371-a0.mongolab.com:51371 | myapp.getnonce | STARTED | {}
MONGODB | ds051371-a0.mongolab.com:51371 | myapp.getnonce | SUCCEEDED | 0.001196958s
MONGODB | ds051371-a0.mongolab.com:51371 | myapp.authenticate | STARTED | {}
MONGODB | ds051371-a0.mongolab.com:51371 | myapp.authenticate | SUCCEEDED | 0.001096091s
MONGODB | ds051371-a0.mongolab.com:51371 | myapp.count | SUCCEEDED | 0.006626804s
My configuration is:
production:
- Configure available database clients. (required)
clients: - Defines the default client. (required)
default:
uri: <%= ENV['MONGOLAB_URI'] %>
options: - max_retries specifies the number of times to attempt an
- operation before giving up.
max_retries: 5
- retry_interval specifies the number of seconds to wait before
- http://blog.mongolab.com/2014/02/mongodb-driver-tips-tricks-mongoid-3/
retry_interval: 30
- The time in seconds before Moped will timeout connection and node
- operations. (default 5)
timeout: 15
- The maximum number of connections in the connection pool. (default: 5)
max_pool_size: 20
- Configure Mongoid specific options. (optional)
options: - Raise an error when performing a #find and the document is not found.
- (default: true)
raise_not_found_error: true
I'm using Mongodb 2.6.8 and Mongoid 5.1.
Mongoid 5.1 should use a connection pool but it seems this is not happening. Any idea why?