In [10]:
import pymongo
In [11]:
from pymongo import MongoClient
client = MongoClient()
In [12]:
db = client.calidad_api
In [13]:
collection = db['places']
In [32]:
#Aqui meti los diccionarios de los lugares uno por uno
place = {
"id": "Camp",
"name":"Cerro de la Campana",
"long":"101.13",
"lat":"103.13",
"timezone":"GMT +6",
"level":"station",
"id_country":"MX",
"id_city":"MTY",
}
In [33]:
places = db.place
In [34]:
place_id = places.insert_one(place).inserted_id
In [40]:
for place in places.find():
print(place)
In [41]:
collection = db['methods']
In [42]:
method = {
"method_id": "met1",
"method_short-description":"Esta es una descripción chida",
"method_protocol":"Pasito 1, Pasito 2, Pasito tun tun",
"method_device":"Supermaquinón 2"
}
In [43]:
methods = db.method
In [44]:
method_id = methods.insert_one(method).inserted_id
In [45]:
methods.find_one()
Out[45]:
In [46]:
collection = db['pollutants']
In [47]:
pollutant = {
"station_id":"Tac",
"pollutant_id":"CO2",
"pollutant_unit":"ug",
"pollutant_update_time":"10/12/2014",
"pollutant_averaging":"5 min",
"pollutant_value":"36"
}
In [48]:
pollutants = db.pollutant
In [49]:
pollutant_id = pollutants.insert_one(pollutant).inserted_id
In [52]:
pollutants.find_one()
Out[52]:
In [ ]: