MongoDB插入、更新、删除文档实现代码
1 创建数据库并插入数据
use jinxt db.adou.insert({name:"jinxt",age:"28"}); //刚创建的数据库 jinxt并不在数据库的列表中, 要显示它,我们需要向 jinxt数据库插入一些数据 show dbs db.dropDatabase(); //删除数据库
2 插入文档
use jinxt db.adou.insert({name:"jinxt",age:28,sex:"男",tags:["高大","威武","雄壮"]}); document=({name:"jinxt2",age:29,sex:"男",tags:["高大","威武","雄壮"]}); db.adou.insert(document); db.adou.find();
相关推荐
lbyd0 2020-11-17
BigYellow 2020-11-16
sushuanglei 2020-11-12
我心似明月 2020-11-09
sdmzhu 2020-09-01
zhushenghan 2020-11-09
sunnnyduan 2020-10-16
不要皱眉 2020-10-14
xiaohai 2020-09-29
songxiugongwang 2020-09-22
萌亖 2020-09-17
LuckyLXG 2020-09-08
mkhhxxttxs 2020-09-16
xiaohai 2020-09-16
newcome 2020-09-09
jaylong 2020-08-19
大秦铁骑 2020-08-19
thatway 2020-08-19