当前位置:网站首页>MongoDB数据库入门的常用命令
MongoDB数据库入门的常用命令
2022-07-03 13:42:00 【稻田里展望者】
选择切换数据库:use articledb
插入数据:db.comment.insert({bson数据})
查询所有数据:db.comment.find();
条件查询数据:db.comment.find({条件})
查询符合条件的第一条记录:db.comment.findOne({条件})
查询符合条件的前几条记录:db.comment.find({条件}).limit(条数)
查询符合条件的跳过的记录:db.comment.find({条件}).skip(条数)
修改数据:db.comment.update({条件},{修改后的数据})db.comment.update({条件},{$set:{要修改部分的字段:数据})
修改数据并自增某字段值:db.comment.update({条件},{$inc:{自增的字段:步进值}})
删除数据:db.comment.remove({条件})
统计查询:db.comment.count({条件})
模糊查询:db.comment.find({字段名:/正则表达式/})
条件比较运算:db.comment.find({字段名:{$gt:值}})
包含查询:db.comment.find({字段名:{$in:[值1,值2]}})db.comment.find({字段名:{$nin:[值1,值2]}})
条件连接查询:db.comment.find({$and:[{条件1},{条件2}]})db.comment.find({$or:[{条件1},{条件2}]})
边栏推荐
- 1px problem of mobile terminal
- JS new challenges
- QT learning 24 layout manager (III)
- Qt学习24 布局管理器(三)
- Exercise 8-2 calculate the sum and difference of two numbers
- [ACNOI2022]猜数
- Global event bus
- QT learning 23 layout manager (II)
- Qt学习25 布局管理器(四)
- Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
猜你喜欢

Cross linked cyclodextrin metal organic framework loaded methotrexate slow-release particles | metal organic porous material uio-66 loaded with flavonoid glycosides | Qiyue

3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)

消息订阅与发布

Solve MySQL 1045 access denied for user 'root' @ 'localhost' (using password: yes)

Exercise 10-2 recursive factorial sum

关于回溯问题中的排列问题的思考(LeetCode46题与47题)

JS Part III

Qt学习20 Qt 中的标准对话框(中)

交联环糊精金属有机骨架负载甲氨蝶呤缓释微粒|金属-有机多孔材料UiO-66负载黄酮苷类药物|齐岳

Redis:Redis的数据结构、key的操作命令
随机推荐
TS code automatically generates JS
How to delete an attribute or method of an object
全局事件总线
Qt学习17 对话框及其类型
Rasp implementation of PHP
Article content typesetting and code highlighting
Onmenusharetimeline custom shared content is invalid, and the title and icon are not displayed
Analysis of the characteristics of page owner
jvm-对象生命周期
Qt学习20 Qt 中的标准对话框(中)
Selenium browser (1)
Qt学习25 布局管理器(四)
Failure of vector insertion element iterator in STL
金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
牛客网:过河卒
Common mixins
QT learning 17 dialog box and its types
Vite project commissioning
JS Part III
JVM class loading