开发者

distinct selects in lithium

开发者 https://www.devze.com 2023-02-28 13:51 出处:网络
Using Lithiums Model, how do you achieve get开发者_JAVA技巧ting a distinct result set of specific fields from a collection in MongoDB?

Using Lithiums Model, how do you achieve get开发者_JAVA技巧ting a distinct result set of specific fields from a collection in MongoDB?

mongo query:

db.blogs.distinct('url');


There currently isn't a way to do this elegantly to my knowledge. You can get results by working with the Pecl MongoDB object directly. The command function allows you to make any call you want.

$db = Connections::get('default');
$blogs = $db->connection->command(array('distinct'=>'blogs', 'key'=>'url'));
0

精彩评论

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