In [1]:
import pymongo
In [2]:
client = pymongo.MongoClient()
In [3]:
db = client['olx']
In [4]:
collection = db['cars']
In [5]:
import datetime as dt
In [6]:
car = {'title': 'Gol Completo', 'ports': 4, 'year': '2015/2016', 'date': dt.datetime.now()}
In [7]:
car
Out[7]:
In [8]:
collection.insert_one(car)
Out[8]:
In [9]:
result = collection.find_one({'title': 'Gol Completo'})
In [ ]: