In order to produce actionable insights from your business intelligence system, you will more than likely need to combine data sources. Let us say that you have
In order to insert a record, we first create the record and then insert it. The new record needs to be in the JSON format.
from pymongo import MongoClient client = MongoClient('localhost', 27017) db = client.pythonbicookbook customers = db.customers import datetime new_customer = {"first_name": "Bob", "last_name": "Smith", "address_1": "123 Main Street", "address_2": "Suite 200", "city": "Washington", "state": "DC", "zipcode": "20036", "interests": ["product_1", "product_4", "product_7"], "contact_requested": True, "created_at": datetime.datetime.utcnow(), "updated_at": datetime.datetime.utcnow()} customer_id = customers.insert_one(new_customer).inserted_id print(customer_id)