首页
看点啥
插画图片
首页 看点啥 mongoDB常用命令

mongoDB常用命令

2026-08-05 0

命令行输入mongo进入数据库操作

mongoDB常用命令

use demo创建或切换到数据库名为demo的数据库

代码演示

E:MongoDBbin>mongoMongoDB shell version: 2.6.5connecting to: test> use demodbswitched to db demodb> db.FirstCollection.insert({name:"jack",age:22})WriteResult({ "nInserted" : 1 })> show collections //显示数据库的表FirstCollectionsystem.indexes > db.getCollectionNames()[ "FirstCollection", "system.indexes" ]> db.demodb.find()> db.FirstCollection.find(){ "_id" : ObjectId("543731431dc491f307663a0d"), "name" : "jack", "age" : 22 }> db.system.indexes.find(){ "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "demodb.FirstCollection" }

登录数据库 db.auth('gary','111111')

进入表查看 db.tablename.find()

喜欢(0)

上一篇

12、web爬虫讲解2—Scrapy框架爬虫—Scrapy模拟浏览器登录—获取Scrapy框架Cookies

12、web爬虫讲解2—Scrapy框架爬虫—Scrapy模拟浏览器登录—获取Scrapy框架Cookies

下一篇

1c扫地机器人装水行不行

1c扫地机器人装水行不行
猜你喜欢