Javascript 我应该在连接字符串中输入什么来将我的NodeJS应用程序连接到MongoDB服务器?

Javascript 我应该在连接字符串中输入什么来将我的NodeJS应用程序连接到MongoDB服务器?,javascript,node.js,mongodb,express,mern,Javascript,Node.js,Mongodb,Express,Mern,我正在尝试将MongoDB连接到nodejs。我有一个运行MongoDB的环境文件和一个连接字符串变量。我只是不知道如何设置字符串来将我创建的数据连接到数据 终端: connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("a301b4da-919f-4e58

我正在尝试将MongoDB连接到nodejs。我有一个运行MongoDB的环境文件和一个连接字符串变量。我只是不知道如何设置字符串来将我创建的数据连接到数据

终端:

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()
---
> 
环境署署长


从连接字符串中删除
gssapiServiceName
压缩器
,并在末尾添加DB名称,如下面的示例所示

CONNECTION_STRING="mongodb://127.0.0.1:27017/db_name"

连接字符串不起作用了吗?请参阅。
CONNECTION_STRING="mongodb://127.0.0.1:27017/db_name"