5 ms·
MongoDB interactive tutorial
- vyrotek 16y agoI found this insanely helpful! At first I thought the tutorial was just a scripted app which only listened for the right queries to move on. I was a little blown away when I realized I could run other queries against the tutorial db.
- latch 16y agoonce you get to lesson 10 or about, it limits the input quite a bit since the lessons start to build atop each other. Before that, or after you are done, you can do a lot. The commands are executed against a real unicorns mongodb collection (each user having his or her own)...so you are only limited by what's been implemented in the javascript shell and on the thin proxy backend. This does mean that someone who wanted to take the server down probably wouldn't have to try very hard.
- Jbudone 16y agoThis tutorial was totally cool! Props to the guy who made this, and for doing something like this while in his bored spare time... 1 complaint however is that it doesn't explain much about the difference between MongoDB and MySQL, or other databases. I was really hoping to get to hear how it compares, what the pros and cons are out of using this vs. other databases
- overgard 16y agoFunny easter egg: If you do db.unicorns.remove({}) after it asks you to list the collections, typing "db.unicorns.count()" will redirect you here: http://www.thinkgeek.com/caffeine/wacky-edibles/e5a7/ http://www.thinkgeek.com/caffeine/wacky-edibles/e5a7/ (At least I think it's an easter egg, I didn't get all the way through. Maybe murdering unicorns is a normal part of the tutorial)
- Joakal 16y agoI tried the first one "It's easy, just enter db.getCollectionNames();" Received: "undefined method `collection_names' for nil:NilClass" Edit: It's relying on my cookie which wasn't enabled, oops. The official MongoDB interactive tutorial: http://try.mongodb.org/ http://try.mongodb.org/ Seems to be a clone of redis: http://try.redis-db.com/ http://try.redis-db.com/
- kchodorow 16y agoActually, the Redis one was a clone of MongoDB's.
- famousactress 16y agoDead simple, and really clever. I actually think this has a really handy pace and tone.
- prodigal_erik 16y agoThe DOM has exactly eight words of content and no forms or links at all. I'm worried about this trend of tutorials from authors who fail to get the very basics like progressive enhancement right. We should be showing pages with better authoring than average to novices, because most of the web will eventually converge on the quality of the average tutorial today.
- whacker 16y agoBeautifully designed. It feels as if I am talking to a real person.
- ch0wn 16y agoI love interactive tutorials! I wish there would be one for python I could pass around (is there?). The timeouts on this particular page could use some tweaking, though.
- tomkr 16y agoAwesome tutorial. It's always fun to mess around with things like this. I am running into a problem with sorting though. On lesson 6 I am sorting with {weight:1} which the tutorial says is wrong, but I get the same answer as sorting on {weight: -1} which is correct according to the tutorial. Or is this a mongodb thing? Anyway, keep up the good work.
- latch 16y agoweight:-1 is correct..since you want the heaviest, you sort by weight descending. weight:1 should have returned documents in ascending order but wasn't working. It's fixed now on the tutorial..as well as in the core web console: https://github.com/karlseguin/Mongo-Web-Admin/commit/761cd4e60682eb4fc8c941fc74d29696159a1bce https://github.com/karlseguin/Mongo-Web-Admin/commit/761cd4e...
- harryh 16y agoIn the real world you probably wouldn't want to have a dob field on the unicorns table. Instead just use the timestamp embedded into the _id field. Pretty good overall though.
- praptak 16y ago"In the real world you probably wouldn't want to have a dob field on the unicorns table. Instead just use the timestamp embedded into the _id field." The real world unicorns are not born on the same second that their db record is created.
- ethangunderson 16y agoThe issue with that is if your DB gets backed and starts queuing writes, the timestamps will be skewed. Obviously this isn't always a show stopper, but a caveat nonetheless.
- mathias_10gen 16y agoActually the _id is usually created client-side so the timestamp will reflect when the application created the object rather than when it was processed by the DB. The only major exception is when the DB creates the _id for an upsert.
- krmmalik 16y agoI'd love something like this for either Javascript itself or Node.js - Any ideas anyone?
- steilpass 16y agoLesson 6 asks for 'Here's a tricky one: get ONLY the NAMES of the 2nd and 3rd heaviest male unicorns' Which made me query: db.unicorns.find({gender:'m'}, {name:1, _id:0}).sort({weight:-1}).skip(1).limit(2) but it wants: db.unicorns.find({gender:'m'}, {name:1}).sort({weight:-1}).skip(1).limit(2)
- latch 16y agoHey, thanks! I didn't know you could exclude the _id like that...I can actually make us of that trick. Going to push out a new version with that, and a few other fixes, in a few.
- lowglow 16y agoLesson 7 quit on me. How do I skip lessons? Ze mouze clickz, zey do nottingz.
- latch 16y agolesson(8);
- coenhyde 16y agoGood tutorial. After lesson 16 all the instructions disappeared and I was left with a white screen. Tried to go to a different lesson or the restart command but the instructions didn't come back. Couldn't replicate the problem unfortunately.
- latch 16y agoya, I've seen this but I can't reproduce it either. Really have no idea. Refresh and lesson(17); should at least let you continue from where you left off.
- reustle 16y agoI still prefer the tutorial on the homepage of mongodb.org. Click "Try it out" and type "tutorial". This is very well done too, though.
- deskamess 16y agoA few latency issues... or is it just tutorial related sluggishness or is it representative of Mongos' CAP tradeoffs? I guess 'eventually consistent' kicked in by the second find query. If that is what really happened, it is really cool to visualize 'eventually consistent'! Output from back to back db.users.find() command. It took a while for Johnny to be updated to Cash. > db.users.find(); [ { "_id" : { "$oid" : "4d82805ecc9374271b03dd8a" }, "name" : "Johnny", "languages" : [ "ruby", "c" ] }, { "_id" : { "$oid" : "4d828066cc9374271b03dd8b" }, "name" : "Sue", "languages" : [ "scala", "lisp" ] } ] > db.users.find(); [ { "_id" : { "$oid" : "4d82805ecc9374271b03dd8a" }, "name" : "Cash", "languages" : [ "english" ] }, { "_id" : { "$oid" : "4d828066cc9374271b03dd8b" }, "name" : "Sue", "languages" : [ "scala", "lisp" ] } ] > Ed: Oops. I was on the try.mongodb.org page. Not the linked article. I am trying that now.