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)取三条数据

相关推荐
夜泉_ly1 小时前
MySQL -安装与初识
数据库·mysql
qq_529835352 小时前
对计算机中缓存的理解和使用Redis作为缓存
数据库·redis·缓存
月光水岸New5 小时前
Ubuntu 中建的mysql数据库使用Navicat for MySQL连接不上
数据库·mysql·ubuntu
狄加山6755 小时前
数据库基础1
数据库
我爱松子鱼5 小时前
mysql之规则优化器RBO
数据库·mysql
chengooooooo5 小时前
苍穹外卖day8 地址上传 用户下单 订单支付
java·服务器·数据库
Rverdoser6 小时前
【SQL】多表查询案例
数据库·sql
Galeoto6 小时前
how to export a table in sqlite, and import into another
数据库·sqlite
人间打气筒(Ada)7 小时前
MySQL主从架构
服务器·数据库·mysql
leegong231117 小时前
学习PostgreSQL专家认证
数据库·学习·postgresql