mongodb学习笔记
#进入数据库 use test #创建一个集合 db.createCollection("runoob") #查看集合 show collections #插入文档 db . col . insert ({ title : 'MongoDB 教程' , description : 'MongoDB 是一个 Nosql 数据库' , by : '菜鸟教程' , url : 'http://www.runoob.com' , tags : [ 'mongodb' , 'database' , 'NoSQL' ], likes : 100 }) #查看集合 show collections #查看文档 db.col.find() #插入多条数据 var res = db . collection . insertMany ([{ "b" : 3 }, { 'c' : 4 }]) #更新数据,前面是查询条件,后面是更新的内容 db . col . update ({ 'title' : 'MongoDB 教程' },{ $set :{ 'title' : 'MongoDB' }}) #查询,等于 db.col.find({"by":"菜鸟教程"}) #查询,大于 db.col.find({"likes":{$gt:150}}) #查询,大于 db.col.find({"likes":{