当前位置:网站首页>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}]})
边栏推荐
- Redis:Redis的数据结构、key的操作命令
- 28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;
- QT learning 21 standard dialog box in QT (Part 2)
- Mysql:insert date:sql error [1292] [22001]: data truncation: incorrect date value:
- Collection of mobile adaptation related articles
- Use vscode to view hex or UTF-8 codes
- Page generation QR code
- Common mixins
- 关于回溯问题中的排列问题的思考(LeetCode46题与47题)
- jvm-对象生命周期
猜你喜欢

7-7 12-24 hour system

Exercise 10-2 recursive factorial sum

Exercise 10-1 judge the three digits that meet the conditions

JS matrix zero

Qt学习23 布局管理器(二)

Polestar美股上市:5.5万台交付如何支持得起超200亿美元估值

Implementation of Muduo asynchronous logging

Exercise 6-1 classify and count the number of characters

Exercise 6-2 using functions to sum special A-string sequences

核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
随机推荐
Article content typesetting and code highlighting
八大排序
虽然不一定最优秀,但一定是最努力的!
Qt学习24 布局管理器(三)
Selenium browser (1)
Uio-66-cooh loaded bendamostine | hydroxyapatite (HA) coated MIL-53 (FE) nanoparticles | baicalin loaded manganese based metal organic skeleton material
JS get DPI, PX to cm, cm to PX
Common mixins
Exercise 8-8 moving letters
TS code automatically generates JS
Exercise 8-7 string sorting
金属有机骨架材料ZIF-8包载姜黄素([email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂
Configure stylelint
Exercise 10-6 recursively find Fabonacci sequence
GRPC的四种数据流以及案例
Scroll detection of the navigation bar enables the navigation bar to slide and fix with no content
PCB中常用快捷键
JS general form submission 1-onsubmit
MySQL data processing value addition, deletion and modification
Qt学习20 Qt 中的标准对话框(中)