mongodb(一) 命令操作

版权声明:本文为博主原创文章,转载请注明出处!!!!!!!!!! https://blog.csdn.net/qq_21434959/article/details/83119916

layout: blog
istop: true
title: “mongodb 命令操作”
date: 2018-08-01
category: mongodb
tags:

  • mongodb

查询

基本查询

模糊查询(示例中:db.student.find前缀find对应的()省略)

|------|----------------------|---------------------------------|
| 说明 | 示例 | mysql语句对比 |
| 等值 | {“name”:“张三”} | where name = ‘张三’ |
| 模糊 | {title:/驾驶机动车/} | where title regexp ‘驾驶机动车’ |

高级查询

数组查询

db.student.find({ pictures: { $exists: true, $not: {$size: 0} } })

模糊查询

db.student.find({"title":/驾驶机动车/})
db.student.find({"title":{$regex:/驾驶机动车/}})

参见

菜鸟教程

猜你喜欢

转载自blog.csdn.net/qq_21434959/article/details/83119916