Reputation:
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
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
Reputation: 5147
pymongo is a client and you need a server too.
From the pymongo tutorial:
https://api.mongodb.com/python/current/tutorial.html
Upvotes: 1