当前位置:网站首页>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}]})
边栏推荐
- [combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
- Qt学习21 Qt 中的标准对话框(下)
- Solution to failure or slow downloading of electron when electron uses electron builder to package
- Fabric. JS document
- Installation impression notes
- Uio-66-cooh loaded bendamostine | hydroxyapatite (HA) coated MIL-53 (FE) nanoparticles | baicalin loaded manganese based metal organic skeleton material
- Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ
- Uniapp tips - set background music
- FPGA test method takes mentor tool as an example
- Redis:Redis的数据结构、key的操作命令
猜你喜欢

Redis: redis data structure and key operation commands

JS matrix zero

7-11 calculation of residential water charges by sections

核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)

Page generation QR code

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

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

Configure stylelint

Exercise 10-1 calculate the sum of 1 to n using recursive functions

Comprehensive case of MySQL data addition, deletion, modification and query
随机推荐
28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;
Use vscode to view hex or UTF-8 codes
JS download files through URL links
Solve the problem of dormitory router campus network sharing login
Spring cup eight school league
愉悦资本新双币基金近40亿元完成首次关账
金属有机骨架材料ZIF-8包载姜黄素([email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂
js 2023. String pair equal to the target string after connection
小项目(servelt+jsp+mysql+EL+JSTL)完成一个登录功能的Servlet,具有增删改查的操作。实现登录身份验证,防止非法登录,防止多点登录,记住用户名密码功能。
Doxorubicin loaded on metal organic framework MIL-88 DOX | folic acid modified uio-66-nh2 doxorubicin loaded [email
7-8 overspeed judgment
Qt学习18 登录对话框实例分析
泰凌冲刺科创板:拟募资13亿 国家大基金与小米长江是股东
【吉林大学】考研初试复试资料分享
Reflection -- basic usage
Uniapp tips - set background music
selenium 浏览器(1)
八大排序
Exercise 7-6 count capital consonants
[ACNOI2022]猜数