jmquintana79
8/8/2016 - 10:22 AM

operating with MongoDB in Python

Operating with MongoDB in Python

import pandas as pd
#from pymongo import Connection
from pymongo import MongoClient # python3.4
from odo import odo


# OPEN CONNECTION
#connection = Connection()
connection = MongoClient() # python3.4

# GET DATABASE
db = connection.database_name

# GET COLLECTION
coll = db.collection_name


""" MONGO DB TO DF"""
df = pd.DataFrame(list(coll.find()))


""" DF TO MONGO DB """
odo(df, db.coll)