Created
October 7, 2015 22:47
-
-
Save joeclark-phd/96ddc6d003eb44a8b56c to your computer and use it in GitHub Desktop.
data load script for flinkedin-clark
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
from pymongo import MongoClient | |
# insert your connection details here | |
MONGO_URL = 'mongodb://<dbuser>:<pass>@<database URL>' | |
# connect to the MongoDB server | |
client = MongoClient(MONGO_URL) | |
# connect to the default database within the server | |
db = client.get_default_database() | |
db.profiles.insert( {"_id":"jmclane","name":"John McLane", | |
"jobs":[{"employer":"NYPD","position":"Lieutenant","start":1988}] | |
} ) | |
db.profiles.insert( {"_id":"j","name":"James Edwards", | |
"jobs":[{"employer":"NYPD","position":"Officer","start":1990}, | |
{"employer":"MIB","position":"Agent","start":1997}] | |
} ) | |
db.profiles.insert( {"_id":"samgamgee","name":"Samwise Gamgee", | |
"jobs":[{"employer":"Bag End","position":"Gardener","start":1954}] | |
} ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment