在php中使用mongodb $ slice功能

时间:2012-07-11 21:23:57

标签: php mongodb

我如何将这个shell翻译成php:

db.products.find({}, {comments:{$slice: 5}}

1 个答案:

答案 0 :(得分:2)

你有什么尝试?

这看起来很简单:

db->products->find( array(), array('comments' => array( '$slice' => 5 ) ) );

简单的翻译有什么特别的错误吗?