Skip to content

Instantly share code, notes, and snippets.

@kevinchisholm
Last active January 11, 2018 13:51
Show Gist options
  • Save kevinchisholm/11b3721d41311f7b7caadfb5c1bed86a to your computer and use it in GitHub Desktop.
Save kevinchisholm/11b3721d41311f7b7caadfb5c1bed86a to your computer and use it in GitHub Desktop.

MongoDB Logo

Code Examples for my Blog Post: XXXXX

//create the madmen collection
db.createCollection('madmen');
//insert five documents in the "madmen collection
db.madmen.insert({'name' : 'Don Draper'});
db.madmen.insert({'name' : 'Roger Sterling'});
db.madmen.insert({'name' : 'Bert Cooper Sterling'});
db.madmen.insert({'name' : 'Peter Campbell'});
db.madmen.insert({'name' : 'Joan Harris'});
//show all of the databases
show dbs
db.madmen.update(
{ "_id" : ObjectId("XXXX") },
{ $set: { "name": "Pete Campbell Jr." } }
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment