Re:MongoDB interactive tutorial
by steilpass on Wednesday March 16, 2011 @06:24AM
(#2331503)
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)
[ Parent
| on HN ]
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.
Lesson 7 quit on me. How do I skip lessons? Ze mouze clickz, zey do nottingz.