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

相关推荐
G***E3169 小时前
MySQL增强现实案例
数据库·mysql·ar
枫叶丹49 小时前
openGauss:面向数字时代的下一代企业级开源关系型数据库
开发语言·数据库·开源·自动化
苦学编程的谢10 小时前
Redis_16_哨兵
数据库·redis·缓存
w***744010 小时前
SQL Server 数据库迁移到 MySQL 的完整指南
android·数据库·mysql
一 乐11 小时前
健身达人小程序|基于java+vue健身达人小程序的系统设计与实现(源码+数据库+文档)
java·前端·数据库·vue.js·spring boot·小程序
q***787811 小时前
PostgreSQL的备份方式
数据库·postgresql
Austindatabases12 小时前
SQLite3 如果突发断电,关机,数据会丢还是不会丢?
数据库·sqlite
青春:一叶知秋15 小时前
【Redis存储】List列表
数据库·redis·缓存
爆更小哇17 小时前
MyBatis的TypeHandler :优雅地实现数据加密与解密
数据库·后端·mybatis
likuolei18 小时前
Eclipse 创建 Java 接口
java·数据库·eclipse