Tag Archives: MongoDB

【MongoDB】 Failed to connect to 127.0.0.1:27017, reason: Connection refused

due to the need of the project, mongodb is installed on a virtual machine, but the following error occurs during startup:

[root@localhost bin]# ./mongo
MongoDB shell version v3.4.0
connecting to: mongodb://127.0.0.1:27017
2018-09-27T21:11:14.779+0800 W NETWORK  [main] Failed to connect to 127.0.0.1:27017, reason: Connection refused
2018-09-27T21:11:14.780+0800 E QUERY    [main] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:234:13
@(connect):1:6
exception: connect failed

the reason for the above may be in the data directory mongod.lock The problem with the document. You can use the command to repair:

[root@localhost mongodb]# ./bin/mongod --repair

but for impatient people like me, I went directly to the directory and deleted the file.
After repairing or deleting, restart mongodb:

./mongod --dbpath=/usr/local/mongodb/data/db/

then appears as follows:

2018-09-27T21:12:16.441+0800 I CONTROL  [initandlisten] MongoDB starting : pid=6748 port=27017 dbpath=/usr/local/mongodb/data/db/ 64-bit host=localhost.localdomain
2018-09-27T21:12:16.441+0800 I CONTROL  [initandlisten] db version v3.4.0
2018-09-27T21:12:16.441+0800 I CONTROL  [initandlisten] git version: f4240c60f005be757399042dc12f6addbc3170c1
2018-09-27T21:12:16.441+0800 I CONTROL  [initandlisten] allocator: tcmalloc
2018-09-27T21:12:16.441+0800 I CONTROL  [initandlisten] modules: none
2018-09-27T21:12:16.441+0800 I CONTROL  [initandlisten] build environment:
2018-09-27T21:12:16.441+0800 I CONTROL  [initandlisten]     distarch: x86_64
2018-09-27T21:12:16.441+0800 I CONTROL  [initandlisten]     target_arch: x86_64
2018-09-27T21:12:16.441+0800 I CONTROL  [initandlisten] options: { storage: { dbPath: "/usr/local/mongodb/data/db/" } }
2018-09-27T21:12:16.482+0800 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1383M,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] 
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] 
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] 
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-09-27T21:12:17.295+0800 I CONTROL  [initandlisten] 
2018-09-27T21:12:17.295+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-09-27T21:12:17.295+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-09-27T21:12:17.295+0800 I CONTROL  [initandlisten] 
2018-09-27T21:12:17.483+0800 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/usr/local/mongodb/data/db/diagnostic.data'
2018-09-27T21:12:17.769+0800 I INDEX    [initandlisten] build index on: admin.system.version properties: { v: 2, key: { version: 1 }, name: "incompatible_with_version_32", ns: "admin.system.version" }
2018-09-27T21:12:17.769+0800 I INDEX    [initandlisten] 	 building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2018-09-27T21:12:17.793+0800 I INDEX    [initandlisten] build index done.  scanned 0 total records. 0 secs
2018-09-27T21:12:17.794+0800 I COMMAND  [initandlisten] setting featureCompatibilityVersion to 3.4
2018-09-27T21:12:17.794+0800 I NETWORK  [thread1] waiting for connections on port 27017
2018-09-27T21:13:22.539+0800 I NETWORK  [thread1] connection accepted from 127.0.0.1:51708 #1 (1 connection now open)
2018-09-27T21:13:22.540+0800 I NETWORK  [conn1] received client metadata from 127.0.0.1:51708 conn1: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "3.4.0" }, os: { type: "Linux", name: "CentOS Linux release 7.5.1804 (Core) ", architecture: "x86_64", version: "Kernel 3.10.0-862.el7.x86_64" } }
2018-09-27T21:14:00.424+0800 I NETWORK  [thread1] connection accepted from 192.168.20.29:10351 #2 (2 connections now open)
2018-09-27T21:14:00.424+0800 I -        [conn2] end connection 192.168.20.29:10351 (2 connections now open)
2018-09-27T21:14:00.969+0800 I NETWORK  [thread1] connection accepted from 192.168.20.29:10386 #3 (2 connections now open)
2018-09-27T21:14:00.969+0800 I NETWORK  [thread1] connection accepted from 192.168.20.29:10387 #4 (3 connections now open)
2018-09-27T21:14:03.063+0800 I NETWORK  [thread1] connection accepted from 192.168.20.29:10392 #5 (4 connections now open)
2018-09-27T21:14:03.063+0800 I NETWORK  [thread1] connection accepted from 192.168.20.29:10393 #6 (5 connections now open)
2018-09-27T21:14:03.063+0800 I -        [conn6] end connection 192.168.20.29:10393 (5 connections now open)
2018-09-27T21:14:03.469+0800 I -        [conn5] end connection 192.168.20.29:10392 (4 connections now open)
2018-09-27T21:16:31.073+0800 I NETWORK  [thread1] connection accepted from 192.168.21.247:1138 #7 (4 connections now open)
2018-09-27T21:16:31.714+0800 I INDEX    [conn7] build index on: NCRE3.01.files properties: { v: 2, key: { filename: 1, uploadDate: 1 }, name: "filename_1_uploadDate_1", ns: "NCRE3.01.files" }
2018-09-27T21:16:31.714+0800 I INDEX    [conn7] 	 building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2018-09-27T21:16:31.765+0800 I INDEX    [conn7] build index done.  scanned 0 total records. 0 secs
2018-09-27T21:16:31.765+0800 I COMMAND  [conn7] insert NCRE3.system.indexes ninserted:1 numYields:0 locks:{ Global: { acquireCount: { r: 1, w: 1 } }, Database: { acquireCount: { W: 1 } }, Collection: { acquireCount: { w: 1 } } } 550ms
2018-09-27T21:16:32.627+0800 I INDEX    [conn7] build index on: NCRE3.01.chunks properties: { v: 2, unique: true, key: { files_id: 1, n: 1 }, name: "files_id_1_n_1", ns: "NCRE3.01.chunks" }
2018-09-27T21:16:32.627+0800 I INDEX    [conn7] 	 building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2018-09-27T21:16:32.994+0800 I INDEX    [conn7] build index done.  scanned 0 total records. 0 secs
2018-09-27T21:16:32.994+0800 I COMMAND  [conn7] insert NCRE3.system.indexes ninserted:1 numYields:0 locks:{ Global: { acquireCount: { r: 1, w: 1 } }, Database: { acquireCount: { W: 1 } }, Collection: { acquireCount: { w: 1 } } } 1216ms
2018-09-27T21:16:35.895+0800 I -        [conn7] end connection 192.168.21.247:1138 (4 connections now open)
^C2018-09-27T21:17:17.799+0800 I CONTROL  [signalProcessingThread] got signal 2 (Interrupt), will terminate after current cmd ends
2018-09-27T21:17:17.799+0800 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
2018-09-27T21:17:17.799+0800 I NETWORK  [signalProcessingThread] closing listening socket: 6
2018-09-27T21:17:17.799+0800 I NETWORK  [signalProcessingThread] closing listening socket: 7
2018-09-27T21:17:17.799+0800 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2018-09-27T21:17:17.801+0800 I NETWORK  [signalProcessingThread] shutdown: going to flush diaglog...
2018-09-27T21:17:17.801+0800 I FTDC     [signalProcessingThread] Shutting down full-time diagnostic data capture
2018-09-27T21:17:17.803+0800 I STORAGE  [signalProcessingThread] WiredTigerKVEngine shutting down
2018-09-27T21:17:19.283+0800 I STORAGE  [signalProcessingThread] shutdown: removing fs lock...
2018-09-27T21:17:19.283+0800 I CONTROL  [signalProcessingThread] now exiting
2018-09-27T21:17:19.283+0800 I CONTROL  [signalProcessingThread] shutting down with code:0

this interface is successful. Then, do not close the interface, open a window again to start:

[root@localhost ~]# cd /usr/local/mongodb
[root@localhost mongodb]# ./bin/mongo
MongoDB shell version v3.4.0
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.0
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
	http://docs.mongodb.org/
Questions?Try the support group
	http://groups.google.com/group/mongodb-user
Server has startup warnings: 
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] 
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] 
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] 
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2018-09-27T21:12:17.294+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-09-27T21:12:17.295+0800 I CONTROL  [initandlisten] 
2018-09-27T21:12:17.295+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-09-27T21:12:17.295+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-09-27T21:12:17.295+0800 I CONTROL  [initandlisten] 

the appearance of such an interface means that the problem has been solved ~
at this time, visit the website and find that mongodb’s service is really started:

thank you for reading ~

How to Install Mongdb4.X in Windows

The installation
windows
After the installation is complete, locate the data directory under the installation directory and create a folder named db in the data directory

Open the cmd command line, move the directory to the bin directory under the MongoDB installation directory, and enter the command
mongod --dbpath <dblocations>
mongod --dbpath D:\MongoDB\data\db

Open your browser and enter the address

http://localhost:27017

The following is a success

It looks like you are trying to access MongoDB over HTTP on the native driver port.

Open the service
Go to the bin directory under the installation directory
perform

-> mongod *--dbpath D:\MongoDB\data\db*
-> mongo   or    mongo --host=127.0.0.1 --port=27017
-> show databases;   //If you see the database information, it is successful

Mongodb (version 3.2) create user error addUser is not a function

When creating a user from the MongoDB command line, the following error is reported:
db.addUser(“lisi”,”123456″);
2016-11-04T19:41:02.563+0800 E QUERY [thread1] TypeError: db.addUser is not a function:

The addUser() method is no longer supported in the mongdb3.x version and is replaced by the createUser() method.

See the section on creating users in the official documentation:
https://docs.mongodb.com/manual/reference/method/js-user-management/

When you add a new user, you can specify the user’s role. Refer to the built-in roles section of the official documentation:
http://docs.mongoing.com/manual-zh/reference/built-in-roles.html
http://www.cnblogs.com/SamOk/p/5162767.html (with Chinese translation)

Also refer to the blog post:
http://blog.csdn.net/unixpro/article/details/47302855

Deploy mongodb fragment combined with replica set to realize distributed storage of MySQL database files (step 10)

Configure the mongos process of the SHARD2 node
[root@shard2 bin]# cat < > /usr/local/mongodb/bin/mongos.conf

bind_ip=192.168.100.103
port=27025
logpath=/usr/local/mongodb/logs/mongos.log
fork=true
maxConns=5000
configdb=configs/192.168.100.101:27017,192.168.100.101:27018,192.168.100.101:27019
END

[root @ shard2 bin] # touch…/logs/mongos.log
[root @ shard2 bin] # chmod 777…/logs/mongos.log
[root @ shard2 bin] # mongos -f/usr/local/mongodb/bin/mongos.conf

about to fork child process, waiting until server is ready for connections.
forked process: 1562
child process started successfully, parent exiting

[root@shard2 ~]# netstat -utpln |grep mongo

tcp        0      0 192.168.100.103:27019   0.0.0.0:*               LISTEN      1095/mongod         
tcp        0      0 192.168.100.103:27020   0.0.0.0:*               LISTEN      1122/mongod         
tcp        0      0 192.168.100.103:27025   0.0.0.0:*               LISTEN      12122/mongos        
tcp        0      0 192.168.100.103:27017   0.0.0.0:*               LISTEN      1041/mongod         
tcp        0      0 192.168.100.103:27018   0.0.0.0:*               LISTEN      1068/mongod 

pymongo.errors.DuplicateKeyError: E11000 duplicate key error collection: anjuke.ershoufang index

This bug kept me busy all afternoon and a night, and finally I ko it
Attach a section of crawling to take anjuke second-hand housing information code
Re
import time
import pymongo
import requests
from bson import ObjectId
from LXML import etree
from pprint import pprint
headers = {
“user-agent “: “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36”,
“cookie”: “aQQ_ajkguid= 243e5d558-8b13-d7bd-4922-3de583e03855; ctid=11; _ga = GA1.2.1030980732.1530799904; _gid = GA1.2.506397644.1530799904; 58tj_uuid=c606f59a-2fb9-4c91-9815-741fdf9cfe5d; als=0; lps=http%3A%2F%2Fwww.anjuke.com%2F%3Fpi%3DPZ-baidu-pc-all-biaoti%7Chttps%3A%2F%2Fwww.baidu.com%2Fs%3Fie%3Dutf-8%26f%3D8%26rsv_bp%3D0%26rsv_idx%3D1%26tn%3Dbaidu%26wd%3D%25E5%25AE%2589%25E5%25B1%2585%25 E5%25AE%25A2%26rsv_pq%3Dd71198bd000395ca%26rsv_t%3D6172VDlcx2zzRQ%252FLyCdcEidtafr%252BSvVyVXrlZ0lsK3U1MEz8066IF4byz4c%26rqlang%3Dcn%26rsv_enter%3D1%26rsv_sug3%3D5%26rsv_sug1%3D5%26rsv_sug7%3D101; twe=2; sessid=3497C1D2-43A8-6143-B2D7-CFDA33FF0C0E; new_uv=2; __xsptplus8 7 c = 8.2.1530840314.1530840335.2%232%7Cwww.baidu.com % % 7 c % 7 c % 25 e5%25 ae b1%2585% % 2589% % 25 e5 25 25 e5%25 ae % 25 a2%23 z7v3xnqldcxthemliqlxqslhvxrh8k_r 7 c % 23% % 23 “,
“referer” : “https://shanghai.anjuke.com/?PI = pz-bid-pc-all-biaoti “
}

# connect to database
client = pymongo.MongoClient(‘127.0.0.1’, 27017)
# define database name
db = client.anjuke
# define table name
coll = db.ershoufang

def get_info():
count = 0
for I in range(23):

response = Requests. The get (‘ # https://shanghai.anjuke.com/sale/p {}/filtersort ‘. The format (I), headers = headers)

item = response. The text

# print (item)
# use etree. HTML, The string into an HTML document.
HTML = etree HTML (item)
HTMLS = HTML. The xpath (‘// * [@ id = “houselist – mod – new”]/li ‘)
# print (HTMLS)

house = {}
for h in HTMLS:
h_addr = h.x path (‘/div [2]/div [1]/a/text () ‘) [0]. The strip ()
h_type = h.x path (‘/div [2]/div [2]/span [1]/text () ‘) [0]. The strip ()
h_area = H.x path (‘/div [2]/div [2]/span [2]/text () ‘) [0]. The strip ()
h_hight = h.x path (‘/div [2]/div [2]/span [3]/text () ‘) [0]. The strip ()
h_name = H.x path (‘/div [2]/div [2]/span [4]/text () ‘) [0]. The strip ()
try:
h_youshi1 = h.x path (‘/div [2]/div [4]/span [1]/text () ‘) [0]. The strip ()
the except:
H_youshi1 = None
try:
h_youshi2 = h.x path (‘/div [2]/div [4]/span [2]/text () ‘) [0]. The strip ()
the except:
h_youshi2 = None
try:
H_youshi3 = h.x path (‘/div [2]/div [4]/span [3]/text () ‘) [0]. The strip ()
the except:
h_youshi3 = None
h_price = H.x path (‘/div [3]/span [1]/strong/text () ‘) [0]. The strip ()

house [‘ h_addr] = h_addr
house [‘ h_type] = h_type
house [‘ h_area] = h_area
House [‘ h_hight] = h_hight
house [‘ h_name] = h_name
house [‘ h_youshi1] = h_youshi1
house [‘ h_youshi2] = h_youshi2
house [‘ h_youshi3] = h_youshi3
House [‘ h_price] = h_price
# pprint (house)
time. Sleep (0.01)

# coll. Insert (house)
save (house)
Count + = 1
print (count)

def save (house) :

coll. Insert (house)

def main () :
get_info ()

if __name__ = = “__main__ ‘:
The main ()
This code can only run two pieces of data,

has two data sets, one with ‘_id’ and one without
There are two solutions:
1. Add a ‘_ID’ into the program. Set the _ID field by yourself instead of the system assignment:

Program no problem:

Two: put house={}, the dictionary inside the for loop:

Either of these approaches will solve the problem, and my personal suggestion is that the second approach, code specification, lets the system assign its own ID

Error: could’t connect to server 127.0.0.1:27017, connection attempt failed

1. If you open the terminal and execute Mongo directly, it will be prompted that you cannot connect to 127.0.0.1:27017
Reason: No mongoDB service running

2. Run mongoDB service method
Open the terminal and execute Mongod — dbPATH D:\ tools \mongoDB\data\ DB (the path that dbPATH points to is the data storage directory created when installing mongoDB, which is the path of data/ DB and can be modified according to the location of the path created by yourself). The contents shown in the following figure will prove that the first step is OK

3. At this point, open another terminal and execute the mongo local connection successfully

 
 

Simple understanding and basic operation of mongodb

What is MongoDB?
MongoDB, written in C++ language, is an open source database system based on distributed file storage.
Adding more nodes guarantees server performance under high loads.
MongoDB is designed to provide scalable, high-performance data storage solutions for WEB applications.
MongoDB stores the data as a document. The data structure is composed of key values (key=> Value) pair composition. MongoDB documents are similar to JSON objects. Field values can contain other documents, arrays, and arrays of documents.
The main features
1.MongoDB is a document-oriented database, which is relatively simple and easy to operate.
2.mongo supports rich query expressions. The query directive USES JSON-like markup to easily query objects and arrays embedded in the document. 3.MongoDB allows the script to be executed on the server side. A function can be written in Javascript to be executed directly on the server side, or the definition of the function can be stored on the server side for the next direct call. 4.MongoDB supports a variety of programming languages :RUBY, PYTHON, JAVA, C++, PHP, C# and other languages.
5.MongoDB installation is simple.
You can download the installation package, in directing a website address is:
https://www.mongodb.com/download-center#community.
The syntax format of MongoDB database creation is as follows:

use DATABASE_NAME

If you want to see all the databases, you can use the show DBS command:

> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
> 

The syntax format of MongoDB database deletion is as follows:

db.dropDatabase()

The createCollection() method is used in MongoDB to create collections.
Grammar format:

db.createCollection(name, options)

The drop() method is used in MongoDB to delete collections.
Grammar format:

db.collection.drop()

Mongodb connection authentication auth failed solution

System: centos7
mongo client: mongo2.6.12
mongo server: mongo3.6
Connection error:

2018-07-02T11:51:48.904+0800 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18, codeName: "AuthenticationFailed" } at src/mongo/shell/db.js:1292
exception: login failed

Reason: Due to the low version of Mongo Client, the authentication mechanism is not supported, resulting in client authentication failure.
Solutions:

sudo yum remove mongodb
sudo yum remove mongodb-server

Install Mongodb3.6 version
Refer to CentOS 7 to install MongoDB 3.6
After successful installation, according to the authentication mechanism set by the server, select scRAM-SHA-1 or MongoDB-CR, and default to SCRAM-SHA-1
Connection command:

mongo -authenticationDatabase admin -u user -p pass -host hostname -port 27017 [--authenticationMechanism SCRAM-SHA-1]

Window installation of MongoDB exception: connect failed exception

After Mongo is installed, the following problems are found after Mongo starts (H: \MongoDB\bin)

It took a lot of searching to find the answer
Create a mongo. config // touch mongo. config with Git

Then add the following in mongo.config


dbpath=H:\MongoDB\data
## all output locations
logpath=H:\MongoDB\log\mongo.log

Create the corresponding folder
in the file directory and then execute the configuration file mongod from the command line

If there is no task exception, do not close the command,
open MongDB/bin directory, then double-click mongo. Exe
, the link has been successful, and the mongo xshell can be executed

The mongoDB service failed to start (exception: connect failed)

[root@localhost bin]# ./mongo
MongoDB shell version v3.4.5
connecting to: mongodb://127.0.0.1:27017
2017-11-20T11:10:49.895+0800 W NETWORK  [thread1] Failed to connect to 127.0.0.1                                                                                        :27017, in(checking socket for error after poll), reason: Connection refused
2017-11-20T11:10:49.896+0800 E QUERY    [thread1] Error: couldn't connect to ser                                                                                        ver 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

The reason is that the database location is not specified

 ./mongod --dbpath /data/db

If your database directory is not /data/db, you can use the -dbpath to specify

. Start service

join

MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect EC

Mongodb is installed, but the MongoDB server is not started.
Step 1: Open CMD and enter the MongoDB bin directory

Step 2: Enter the instruction: MonGod — dbPATH database path
If successful, it will be shown as follows:

Step 3: Leave the window open and open another CMD
Enter the bin directory of MongoDB again and enter Mongo, which is shown as follows:

 
 
Finally, you can run mongo on the console. Such as:

MongoNetworkError: failed to connect to server [localhost:27017]

MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connection 0 to localhost:27017 timed out
    at Socket.<anonymous> (D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\connection.js:355:7)     
    at Object.onceWrapper (events.js:427:28)
    at Socket.emit (events.js:321:20)
    at Socket._onTimeout (net.js:478:8)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7) {
  name: 'MongoNetworkError'
}]
    at Pool.<anonymous> (D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\topologies\server.js:438:11)
    at Pool.emit (events.js:321:20)
    at D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\pool.js:562:14
    at D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\pool.js:995:11
    at callback (D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\connect.js:97:5)
    at D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\connect.js:124:7
    at _callback (D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\connect.js:349:5)
    at Connection.errorHandler (D:\Desktop\node\mongodblearn\07_student_list\node_modules\mongodb\lib\core\connection\connect.js:365:5)   
    at Object.onceWrapper (events.js:428:26)
    at Connection.emit (events.js:321:20) {
  name: 'MongoNetworkError'
}

The above error indicates that Mongodb is not started