Skip to content

Instantly share code, notes, and snippets.

@joeclark-phd
Created October 7, 2015 22:47
Show Gist options
  • Save joeclark-phd/96ddc6d003eb44a8b56c to your computer and use it in GitHub Desktop.
Save joeclark-phd/96ddc6d003eb44a8b56c to your computer and use it in GitHub Desktop.
data load script for flinkedin-clark
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