Closed mkgn closed 5 years ago
This bug was fixed at v1.8.0
Now I get;
TimeoutError: ResourceRequest timed out at ResourceRequest._fireTimeout (/usr/src/app/node_modules/generic-pool/lib/ResourceRequest.js:62:17)
I did ;
npm update koa-mongo before building the app.
Make sure that your mongodb is started
timeout doesn't make sense because if i try the same connection settings in mongo compass it works. i tried uri: mongodb://localhost:27017/clicknwin?authSource=none In Uri, i added authsource=none (which i think is not necessary) just to test since in the compass connection UI it's authsource is set to none.
I thought this may be a result of the change. Anyway i'll look further and let you know.
Hi, Sorry for re-opening this again. Have you tried with latest Mongo 4.0, Node v10.15.2? Are you on a windows platform?
This sample : https://github.com/ceoworks/tutorial1-api-koa works fine, but it uses old mongo driver (2.2.10).
In your case, I updated the genericPool.createPool() and just added a console.log to catch() part and the error is; {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":27017}
i tried below connection strings: mongodb://127.0.0.1:27017/clicknwin mongodb://localhost:27017/clicknwin
Nothing works. But both works in that sample which is using the old driver. In my windows host file I have pointed 127.0.0.1 to localhost as well. also ::1 to localhost. So this shouldn't be a problem.
My environment:
Run this repo's example.js
is ok.
I am on Koa2. My koa-mongo setup is;
The database exists can with the given uri, i can connect to mongo using compass. However when I run, it throws the below error.
TypeError: ctx.mongo.db is not a function at koaMongo (/usr/src/app/node_modules/koa-mongo/index.js:65:24)
I can't seem to find any issue in your code either (where you parse the db name). Anything abnormal you see in mine?