Live data from Hacker News

MongoDB interactive tutorial

mongly.com

11–20 of 26 posts

Re: MongoDB interactive tutorial

#11
Awesome 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.

Re: MongoDB interactive tutorial

#14
Lesson 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)

Re: MongoDB interactive tutorial

#15

Lesson 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)

Hey, 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.

Re: MongoDB interactive tutorial

#16
post #11

Awesome 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.

weight:-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/761cd4e...

Re: MongoDB interactive tutorial

#17
Good 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.

Re: MongoDB interactive tutorial

#19

Good 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.

ya, 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.

Re: MongoDB interactive tutorial

#20
post #6

I 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/ Seems to be a clone of redis: http://try.redis-db.com/

Actually, the Redis one was a clone of MongoDB's.
Post reply on HN