Yii框架下MongoDB如何查询单个Collection下所有数据的单个字段?
某草草
某草草 2017-04-26 09:03:33
0
2
901

网上查了很多资料,基本上是原生方法,或者是只能查询一条:

以上为例,是否可以查询该表中所有数据的"_id"字段?

某草草
某草草

reply all(2)
伊谢尔伦

No conditions, then specify the query field

阿神

$criteria = new EMongoCriteria();
$criteria->sort('posts_count',EMongoCriteria::SORT_DESC)
->limit(25)
->offset(0);
$test_id = Group::model()->findAll($criteria);
$test_id->next();
$_ids = array();
$name_id = array();
while($row = $test_id->current()){
$t = $row->attributes;
$name_id[] = array_splice($t,0,2);
$_ids[] = $name_id;
$test_id->next();
}
$test_id = $_ids[count($_ids)-1];
This is a last resort solution, but it feels so stupid.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template