登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
登录
注册
代码拉取完成,页面将自动刷新
开源项目
>
WEB应用开发
>
Web开发框架
&&
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
250
Star
531
Fork
195
ThinkPHP
/
thinkphp32
代码
Issues
35
Pull Requests
4
Wiki
统计
流水线
服务
PHPDoc
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
我知道了,不再自动展开
15
添加非常多的Mongo操作方法
已合并
树海:master
ThinkPHP:master
树海
创建于 2014-08-01 10:48
克隆/下载
HTTPS
SSH
复制
下载 Email Patch
下载 Diff 文件
1,允许返回Mongo对象,进行MongoClient原生操作 MongoModel->getDB(); MongoModel->getCollection(); ```php $m = new MongoModel(); $c = $m->getCollection(); $c->ensureIndex(array("day"=>1)); → array( 'createdCollectionAutomatically' => false, 'numIndexesBefore' => 1, 'numIndexesAfter' => 2, 'ok' => 1 ) ``` 2,添加多种查询条件,支持子查询条件,支持or nor not逻辑,合并deeka提供的多层逻辑的查询方法 ```php //子查询OR逻辑 $map['device.channel'] = "umeng"; $map['_logic'] = 'and'; $map['_complex'] = array("act"=>"down", "group"=>"download", '_logic'=>"or"); $result = $model->field(array("act"=>true, "group"=>true, "_id"=>false))->where($map)->limit(2)->select(); print_r($result); print_r($model->_sql()); echo PHP_EOL; //子查询OR逻辑 $map['_complex'] = array('_logic'=>"or", array("act"=>"down"), array("group"=>"download")); $result = $model->where($map)->find(); print_r($result); print_r($model->_sql()); echo PHP_EOL; //子查询OR逻辑 $map = array(); $map['_complex'] = array('_logic'=>"or", array("act"=>"down"), array("group"=>"download")); $result = $model->field(array("act"=>true, "group"=>true, "_id"=>false))->where($map)->find(); print_r($result); print_r($model->_sql()); echo PHP_EOL; //子查询 AND 逻辑 $map = array(); $map['_complex'] = array('_logic'=>"and", array("act"=>"down"), array("group"=>"download")); $result = $model->field(array("act"=>true, "group"=>true, "_id"=>true))->where($map)->find(); print_r($result); print_r($model->_sql()); echo PHP_EOL; //子查询 nor 逻辑 $map = array(); $map['_complex'] = array('_logic'=>"nor", array("act"=>"down"), array("group"=>"download")); $result = $model->field(array("act"=>true, "group"=>true, "_id"=>true))->where($map)->find(); print_r($result); print_r($model->_sql()); echo PHP_EOL; //$not查询 $map = array(); $map['day'] = '20140710'; $map['act'] = array('$exists'=>true, '$not'=>array('$in'=>array("click", "listview")) ); $map['_complex'] = array('_logic'=>"nor", array("act"=>"down"), array("group"=>"download")); $result = $model->field(array("act"=>true, "group"=>true, "_id"=>true))->where($map)->find(); print_r($result); print_r($model->_sql()); echo PHP_EOL; //$not查询 $map = array(); $map['day'] = '20140710'; $map['_logic'] = 'or'; $map['act'] = array('$exists'=>true, '$not'=>array('$in'=>array("click", "listview")) ); $map['_complex'] = array('_logic'=>"nor", array("act"=>"down"), array("group"=>"download")); $result = $model->field(array("act"=>true, "group"=>true, "_id"=>true))->where($map)->find(); print_r($result); print_r($model->_sql()); echo PHP_EOL; ``` 3,支持更加丰富的获取field字段的功能,支持屏蔽_id字段 ```php $result = $model->field(array("act"=>true, "group"=>true, "_id"=>true))->where($map)->find(); ```
检查系统是否可以自动合并此 Pull Request...
怎样手动合并此 Pull Request
git checkout master
git pull https://gitee.com/vus520/thinkphp.git master
git push origin master
评论
0
提交
文件
2
检查
代码问题
0
批量操作
展开设置
折叠设置
审查
Code Owner
审查人员
麦当苗儿
Aoiujz
luofei614
luofei
云无心
yunwuxin
huangdijia
huangdijia
流年
liu21st_admin
未设置
最少人数
0
测试
麦当苗儿
Aoiujz
luofei614
luofei
云无心
yunwuxin
huangdijia
huangdijia
流年
liu21st_admin
未设置
最少人数
0
优先级
不指定
严重
主要
次要
不重要
标签
标签管理
未设置
关联 Issue
未关联
Pull Request 合并后将关闭上述关联 Issue
里程碑
未关联里程碑
参与者
(1)
PHP
1
https://gitee.com/liu21st/thinkphp32.git
git@gitee.com:liu21st/thinkphp32.git
liu21st
thinkphp32
thinkphp32
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册