Skip to content

Instantly share code, notes, and snippets.

@tqyq
Last active September 11, 2015 01:32
Show Gist options
  • Save tqyq/4d1bbc6dd797727b8d97 to your computer and use it in GitHub Desktop.
Save tqyq/4d1bbc6dd797727b8d97 to your computer and use it in GitHub Desktop.
mongodb native query in thinkphp framework
public function test()
{
$u = D('User')->getCollection()->find(['$or'=>[['mobile'=>'13888888888'], ['name'=>'test1']]]);
foreach ($u as $v) {
json_out($v);
}
$u = D('User')->getCollection()->distinct('name');
json_out($u);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment