创建数据库
1
use mydb2
show dbs3
db.movie.insert({"name":"tutorials point"})删除数据库
1
>use mydb
switched to db mydb
>db.dropDatabase()
>{ "dropped" : "mydb", "ok" : 1 }db.site.drop()
创建集合
1
db.createCollection("mycollection")2
db.createCollection("mycol", { capped : true, autoIndexID : true, size : 6142800, max : 10000 } )3
db.tutorialspoint.insert({"name" : "tutorialspoint"})删除集合
1
db.mycollection.drop()插入文档
>db.col.insert({title: 'MongoDB 教程', description: 'MongoDB 是一个 Nosql 数据库', by: '菜鸟教程', url: 'http://www.runoob.com', tags: ['mongodb', 'database', 'NoSQL'], likes: 100 })
本文介绍了MongoDB数据库的基本操作流程,包括创建与删除数据库、集合,以及如何插入文档等核心内容。通过具体命令实例展示了MongoDB的使用方法。
1984

被折叠的 条评论
为什么被折叠?



