views:

36

answers:

1

Lets say we have a posts collection, and embedded in posts is an array of comments.

How would I write a query to say, pull out only posts 11-20? A mongoid solution would be preferable, but a mongo query object would also be fine

+2  A: 

You want the $slice operator

http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24sliceoperator

Amala
looks like what I was looking for, thanks :)
Matt Briggs