mongodb shell games: here be dragons .. and javascript!

17
1 Stephen Steneker [email protected]

Upload: stephen-steneker

Post on 08-May-2015

510 views

Category:

Technology


0 download

DESCRIPTION

Lightning talk on using and extending MongoDB's "mongo" interactive JavaScript shell. First presented at MongoDB Melbourne 2012: http://www.mongodb.com/events/mongodb-melbourne. This includes some basic tips & tricks through to adding plugins and other goodies. Applicable to MongoDB 2.2+, although Date.toISOString() is now a built-in in MongoDB 2.4+ due to the upgraded V8 JavaScript interpreter.

TRANSCRIPT

Page 1: MongoDB shell games: Here be dragons .. and JavaScript!

1

Stephen Steneker [email protected]

Page 2: MongoDB shell games: Here be dragons .. and JavaScript!

2

Page 3: MongoDB shell games: Here be dragons .. and JavaScript!

3 Use the TAB, Luke!!

Page 4: MongoDB shell games: Here be dragons .. and JavaScript!

4

Page 5: MongoDB shell games: Here be dragons .. and JavaScript!

5 https://gist.github.com/stennie!)!

Page 6: MongoDB shell games: Here be dragons .. and JavaScript!

6 edit functionname!

Page 7: MongoDB shell games: Here be dragons .. and JavaScript!

7 ~/.mongorc.js!

Page 8: MongoDB shell games: Here be dragons .. and JavaScript!

8 http://skratchdot.com/projects/mongodb-schema/!

Page 9: MongoDB shell games: Here be dragons .. and JavaScript!

9 DBQuery.prototype._prettyShell = true;!

Page 10: MongoDB shell games: Here be dragons .. and JavaScript!

10

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString!

Page 11: MongoDB shell games: Here be dragons .. and JavaScript!

11 http://stackoverflow.com/questions/8749971!

Page 12: MongoDB shell games: Here be dragons .. and JavaScript!

12

db.getSiblingDB(‘dbname’).collection.command!

Page 13: MongoDB shell games: Here be dragons .. and JavaScript!

13

www.mongodb.org/display/DOCS/dbshell+(mongo)+Reference!

Page 14: MongoDB shell games: Here be dragons .. and JavaScript!

14

system.js!

Page 15: MongoDB shell games: Here be dragons .. and JavaScript!

15

Many of the mongo shell commands are JS helpers .. call without ()!

Page 16: MongoDB shell games: Here be dragons .. and JavaScript!

16 https://github.com/TylerBrock/mongo-hacker!

Page 17: MongoDB shell games: Here be dragons .. and JavaScript!

17

•  https://github.com/TylerBrock/mongo-hacker •  https://github.com/karlseguin/MongoPlus •  http://skratchdot.com/projects/mongodb-schema/ •  http://skratchdot.com/projects/mesh/ •  https://gist.github.com/stennie

–  https://gist.github.com/3179786 –  https://gist.github.com/3144323

•  Ideas? Share .. !