Hi I have a problem with the connection pooling section of the mflix application.
I have changed the connection options for the MongClient connect method like so:
MongoClient.connect(
process.env.MFLIX_DB_URI,
{poolSize: 50, useNewUrlParser: true},
)
, but I still get an error when I run the jest test suite
> server@1.0.0 test D:\Javascript\mongodb\mflix-js
> jest --passWithNoTests "connection-pooling"
Determining test suites to run...Setup Mongo Connection
(node:12716) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:12716) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
FAIL test/connection-pooling.test.js
Connection Pooling
× Connection pool size is 50 (282ms)
● Connection Pooling › Connection pool size is 50
expect(received).toBe(expected) // Object.is equality
Expected: 50
Received: undefined
8 | test("Connection pool size is 50", async () => {
9 | const response = await MoviesDAO.getConfiguration()
> 10 | expect(response.poolSize).toBe(50)
| ^
11 | })
12 | })
13 |
at toBe (test/connection-pooling.test.js:10:31)
at tryCatch (node_modules/regenerator-runtime/runtime.js:63:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:293:22)
at Generator.next (node_modules/regenerator-runtime/runtime.js:118:21)
at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 3.109s
Ran all test suites matching /connection-pooling/i.
Teardown Mongo Connection
npm ERR! Test failed. See above for more details.
Instead I use the URI string options to specify the pool size and it works
MFLIX_DB_URI=mongodb+srv://m220student:mypass@myhost/sample_mflix?poolSize=50&retryWrites=true
Anyone that can Help?