user1464878
user1464878

Reputation:

How to start mongodb in windows 10

I have installed mongo-db from the Jupyter notebook using !pip install pymongo.

Now how to start mongodb. Is there any way to start mongodb through Juyter Notebook.

from pymongo import MongoClient
client = MongoClient()
#print (client)
#client = MongoClient('mongodb://localhost:27017')
db  = client['test-database']
#print (db)
courses = db.courses
#print (courses)
course = {
    'author':'Mak',
    'course':'Data',
    'price': 100,
    'rating':5
    }
result = courses.insert_one(course)

I am getting ServerSelectionTimeoutError Traceback (most recent call last) since there is no mongodb started

Upvotes: 0

Views: 491

Answers (2)

user1464878
user1464878

Reputation:

Thanks @match

Install server before using it

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/

go to folder where you installed mongodb

C:\Program Files\MongoDB\Server\4.0\bin>

start mongo.exe

Upvotes: 0

matcheek
matcheek

Reputation: 5147

pymongo is a client and you need a server too.

From the pymongo tutorial:

enter image description here

https://api.mongodb.com/python/current/tutorial.html

Upvotes: 1

Related Questions