开发者

Finding all items before a certain item in mongomapper

I want to find all items before a certain item in mongomapper.

For example if I have five User classes saved and I pass in the ID of user 3 then I expect to get back the first two items.

Any开发者_高级运维 ideas how to do this efficiently?


The ObjectID key in Mongo is comprised of a few things, one of them being a timestamp. You can probably use that as a condition on which to query. Look here for more details, http://mongotips.com/b/a-few-objectid-tricks/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜