Ticket Connection - Cannot connect

Hi
I guess I have done all necessary steps (at least not seeing what is missing), but the connection is not hsppening

jest --passWithNoTests “db-connection”

Determining test suites to run…Setup Mongo Connection
FAIL test/db-connection.test.js
● Test suite failed to run

TypeError: Cannot read property 'close' of undefined

  17 | 
  18 |   async teardown() {
> 19 |     await this.global.mflixClient.close()
     |                                   ^
  20 |     await super.teardown()
  21 |   }
  22 | 

  at MongoEnvironment.teardown (test/config/mongoEnvironment.js:19:35)
      at Generator.throw (<anonymous>)

Test Suites: 1 failed, 1 total

I have renamed the file to .env
The URI is as below
MFLIX_DB_URI=mongodb+srv://m220student:m220password@mflix-xdxkx.gcp.mongodb.net/test
MFLIX_NS=sample_mflix
I am able to connect with mongo shell to the server, so no issue on F/W

I checked other posts, but similar issue was not answered.
Wondering if there is any node/npm version compatibility issue
I have npm 6.5.0-next.0 and node 11.6.0

When trying to do npm start, I am getting
Error: querySrv EREFUSED _mongodb._tcp.mflix-xdxkx.gcp.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (dns.js:198:19)

Wondering if there is any issue between version of mongodb driver for Node and MongoDB Atlas version

I am unable to connect with the following connection string. Please cross-check your connection string for any extra character.

Please share the connection string which you used when you connected from the shell.

Kanika

Hi
For mongo shell, using
mongo “mongodb+srv://mflix-xdxkx.gcp.mongodb.net/test” --username m220student
Which is working with the password m220password
I checked from unwanted char in the string, but cannot just see it

Oh! Please try after removing /test argument.

  MFLIX_DB_URI=mongodb+srv://m220student:m220password@mflix-xdxkx.gcp.mongodb.net

Let me know if it works.

Kanika

I have removed and no change
Wondering if you are able to connect. The DB is open to any IP

Yes, I am able to connect through your connection string. Did you rename the file to .env ? If not, please do that.

  MFLIX_DB_URI=mongodb+srv://m220student:m220password@mflix-xdxkx.gcp.mongodb.net

Kanika

Then it should be an environment issue

Yes the file is renamed to .env

Le mar. 23 juil. 2019 à 23:50, Kanika Singla via MongoDB University Discussion Forum mongodb_university@discoursemail.com a écrit :