yii2 mongodb 操作

->where(['<>','review',""]) 不等于空

where = \['newstypeid'=\>\['in'=>categoryIdArr\]\]; 类似mysql in操作 (categoryIdArr是数组)

->where(['label'=>['$regex' =>'赞美诗']]) 模糊搜索操作

where = \['status'=\>1,'name'=\>\['regex' =>$search]];

多个条件查询

andWhere() orWhere()

查询字段

->select(['title','content','dynasty','author','author_id','id'])

查询表

->from()

查询多条数据和单条数据

->all() ->one()

排序

->orderBy(['newsid' => SORT_DESC,])

限制

->offset(3)从第三条开始

->limit(3)取三条数据

相关推荐
m0_6239556628 分钟前
Oracle使用SQL一次性向表中插入多行数据
数据库·sql·oracle
阿蒙Amon1 小时前
C#读写文件:多种方式详解
开发语言·数据库·c#
东窗西篱梦1 小时前
Redis集群部署指南:高可用与分布式实践
数据库·redis·分布式
就是有点傻2 小时前
C#如何实现中英文快速切换
数据库·c#
1024小神3 小时前
hono框架绑定cloudflare的d1数据库操作步骤
数据库
KellenKellenHao4 小时前
MySQL数据库主从复制
数据库·mysql
@ chen5 小时前
Redis事务机制
数据库·redis
KaiwuDB5 小时前
使用Docker实现KWDB数据库的快速部署与配置
数据库·docker
一只fish5 小时前
MySQL 8.0 OCP 1Z0-908 题目解析(16)
数据库·mysql
泊浮目6 小时前
未来数据库硬件-网络篇
数据库·架构·云计算