Vaibhav07
Vaibhav07

Reputation: 223

Confusion about MongoDB about how it works

I have installed mongoDB community version I don't know if mongo Daemon also comes with that. I was following Documentation for ubuntu as I am using Ubuntu 20.04 LTS.

when I run mongod it gives this error

{"t":{"$date":"2021-03-27T20:45:27.371+05:30"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-03-27T20:45:27.371+05:30"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2021-03-27T20:45:27.371+05:30"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":8754,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"vaibhav"}}
{"t":{"$date":"2021-03-27T20:45:27.371+05:30"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.4","gitVersion":"8db30a63db1a9d84bdcad0c83369623f708e0397","openSSLVersion":"OpenSSL 1.1.1f  31 Mar 2020","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2004","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-03-27T20:45:27.371+05:30"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"20.04"}}}
{"t":{"$date":"2021-03-27T20:45:27.371+05:30"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2021-03-27T20:45:27.372+05:30"},"s":"E",  "c":"NETWORK",  "id":23024,   "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"}}
{"t":{"$date":"2021-03-27T20:45:27.372+05:30"},"s":"F",  "c":"-",        "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":919}}
{"t":{"$date":"2021-03-27T20:45:27.372+05:30"},"s":"F",  "c":"-",        "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}

basically I want to connect node with mongoDB locally. I came across this Document so I did the same thing that it said. Upon running node app.js I got

(node:14039) [MONGODB DRIVER] Warning: 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. Connected MongoDB: mongodb://127.0.0.1:27017 Database: myname

I don't understand if it is connected to the node or not and what is the deprecation message and how to fix it? why doesn't mongod command work mbut whereas mongo is working and I can add databases through it? what's the difference between doing that using mongo and mongod? kindly suggest me document regarding this if there is any.

Upvotes: 0

Views: 147

Answers (1)

https://mongodb.github.io/node-mongodb-native/3.6/reference/unified-topology/

NOTE: In upcoming minor versions useUnifiedTopology will default to true, and in the next major version of the driver this topology will outright replace the legacy topologies.

change from

MongoClient.connect(url, { useNewUrlParser: true }

to

MongoClient.connect(url, { useNewUrlParser: true, useUnifiedTopology: true }

Upvotes: 2

Related Questions