通过CMD对MongoDB进行数据的增删改查

Win+R打开CMD,输入mongo

1.use first_mongoDb为建库语句

2.db.first_mongoDb.insert({"name":"first_mongoDB"})为向库中插入一条数据只有插入数据后,查看数据库的时候,才会显示出这个库

3.show dbs为查看所有数据库语句

1.db.createCollection('first');——创建collection

2.show collections;—— 查看当前库下的collections

1.db.first.insert({name:'first',age:22})——插入

2.db.first.find();——查询

1.show tables;——查看

2.db.first.drop();——删除

db.first.update({name:'first'},{$set:{name:'my_first'}})——修改

db.help();——查询帮助

参考链接:

mongodb入门命令-创建表数据(二)

用CMD命令行使用 mongodb 增删改查 基本操作

MongoDB教程

原文地址:https://www.cnblogs.com/miao-com/p/15484747.html