What I need to accomplish is to make four have functions to create / insert, read / select, update and delete records in a mongodatabase. Still can't figure it out how to do that. I have already try some stuff (see script). Anyone want to make it work with the additional functions?
import pymongo
import pprint
from pymongo import MongoClient
client = MongoClient()
db = client.test
collection = db.restaurants
pprint.pprint(collection.find_one())
def db_restaurants_insert(
insert_new = ( {
"address": {
"street": "2 Avenue",
"zipcode": "10075",
"building": "1480"
} }
)
result = post.insert(insert_new)
print (post)
import pymongo
import pprint
from pymongo import MongoClient
client = MongoClient()
db = client.test
collection = db.restaurants
pprint.pprint(collection.find_one())
def db_restaurants_insert(
insert_new = ( {
"address": {
"street": "2 Avenue",
"zipcode": "10075",
"building": "1480"
} }
)
result = post.insert(insert_new)
print (post)