MongoDB数据删除的命令
更新:HHH   时间:2023-1-7


本篇内容主要讲解“MongoDB数据删除的命令”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“MongoDB数据删除的命令”吧!

1.查看集合

show collections

2.向集合中添加数据

db.runoob.insertOne(

{

'title':'remove method',

'url':'https://blog.51cto.com/suyanzhu',

'description':'this is my blog'

}

)

db.runoob.insertMany([

{

'title':'data1',

'url':'https://blog.51cto.com/suyanzhu',

'description':'this is data1'

},

{

'title':'data2',

'url':'https://blog.51cto.com/suyanzhu',

'description':'this is data2'

}

])

3.查看数据

db.runoob.find().pretty()

4.删除单个数据

db.runoob.deleteOne({'title':'remove method'})

5.查看数据

db.runoob.find().pretty()

到此,相信大家对“MongoDB数据删除的命令”有了更深的了解,不妨来实际操作一番吧!这里是天达云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

返回MongoDB数据库教程...