What should I enter to the connection string to connect my NodeJS application to a MongoDB server?

32
April 17, 2021, at 05:20 AM

I am trying to connect to a MongoDB to a nodejs. I have the MongoDB running and I have an ENV file with a connection string variable. I just don't know what to set the string to connect the data I created to the data.

Terminal:

connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("a301b4da-919f-4e58-a524-b6851fac71c7") }
MongoDB server version: 4.4.4
---
The server generated these startup warnings when booting: 
        2021-04-15T18:15:59.961-04:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
        2021-04-15T18:15:59.961-04:00: Soft rlimits too low
        2021-04-15T18:15:59.961-04:00:         currentValue: 256
        2021-04-15T18:15:59.961-04:00:         recommendedMinimum: 64000
---
---
        Enable MongoDB's free cloud-based monitoring service, which will then receive and display
        metrics about your deployment (disk utilization, CPU, operation statistics, etc).
        The monitoring data will be available on a MongoDB website with a unique URL accessible to you
        and anyone you share the URL with. MongoDB may use this information to make product
        improvements and to suggest MongoDB products and deployment options to you.
        To enable free monitoring, run the following command: db.enableFreeMonitoring()
        To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
> 

.env

CONNECTION_STRING="mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb"
Answer 1

Remove gssapiServiceName & compressors from connection string and add DB name at the end like the example below

CONNECTION_STRING="mongodb://127.0.0.1:27017/db_name"
READ ALSO
How to achieve accordion functionality in this?

How to achieve accordion functionality in this?

I am trying to achieve bootstrap accordion like functionality in this code, what I want is one collapse should hide when other one opensI am using bootstrap 3

60
How to save the frames of video on Local Disk?

How to save the frames of video on Local Disk?

I am extracting frames from video , it is extracting and displaying all the frames on canvas means on the web browserI am trying to save that frame on disk using local-storage

22
Regex: match string followed by dot/comma followed by space

Regex: match string followed by dot/comma followed by space

i want to turn my text = "hello this is me, and only mebe carefull from 911

57