This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Suttipong Kullawattana
First step, Install python 3.9.1 for use on python and write the code below
import pymongo
from pymongo import MongoClient
username='myUserAdmin'
password='abc123'
client = MongoClient('mongodb://%s:%s@127.0.0.1' % (username, password))
db=client['mongotestdb']
my_collection = db["patient_data"]
patient_record = {
"Name": "Maureen Skinner",
"Age": 87,
"Sex": "F",
"Blood pressure": [{"sys": 156}, {"dia": 82}],
"Heart rate": 82
}
my_collection.insert_one(patient_record)
for item in my_collection.find():
print(item)
Second step, Install homebrew with $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Third step, Install Jupyter Notebook on Windows, MacOS or Linux and try to install $ pip install notebook
in terminal and run $ jupyter notebook
Fourth step, Install MongoDB Community Edition on macOS mongoDB
install $ brew tap mongodb/brew
Five step, Install mongosh for start mongosh, and create role user on database
Result on MongoDB Compass
Reference : start connecting mongoDB with Jupyter Notebook, MongoDB Community,
Getting started with mongodb pyspark and jupyter-notebook
This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Suttipong Kullawattana
Suttipong Kullawattana | Sciencx (2022-10-15T13:11:29+00:00) How to setup MongoDB with Jupyter Notebook. Retrieved from https://www.scien.cx/2022/10/15/how-to-setup-mongodb-with-jupyter-notebook/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.