Last active
August 2, 2019 09:46
-
-
Save amitrani6/6e363af2f603d71846c7968649646645 to your computer and use it in GitHub Desktop.
Creation of a database and collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This code creates the mongo collection once you initialize a mongo | |
#shell in a terminal window by simply typing the command 'mongo' | |
import pymongo | |
#The default URI is revealed once a mongo shell is initiated | |
#If necessary, replace the URI with the port that the database | |
#is located in | |
client = pymongo.MongoClient("mongodb://127.0.0.1:27017/") | |
#The name of the client is 'television_data' | |
db = client['television_data'] | |
#The name of the collection is 'product_information' | |
product_info_collection = db['product_information'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment