mongodb数据库的使用

1.安装

官网下载:Install MongoDB Community Kubernetes Operator | MongoDBDownload the MongoDB Community Kubernetes Operator for full control of MongoDB deployments from Kubernetes. Free for development.https://www.mongodb.com/try/download/community-kubernetes-operator

也可以下载6.0.5,不过下载6.0.5需要在下一个mongodb的shell连接器,可以直接使用mongodb5.0.15的shell连接器

 

2.使用

MongoDB 概念解析 | 菜鸟教程

 启动mongodb服务

 连接mongodb服务

 

 3.mongoDb Shell下载安装与使用

Install mongosh — MongoDB Shell

4.插入

db.collection.insert() — MongoDB Manual

db.collection.insert()

db.collection.insert(
   <document or array of documents>,
   {
     writeConcern: <document>,
     ordered: <boolean>
   }
)

db.products.insert( { item: "card", qty: 15 } )

db.products.insert(
   [
     { _id: 11, item: "pencil", qty: 50, type: "no.2" },
     { item: "pen", qty: 20 },
     { item: "eraser", qty: 25 }
   ]
)

db.collection.insertOne() — MongoDB Manual

db.collection.insertOne()

db.collection.insertOne(
   <document>,
   {
      writeConcern: <document>
   }
)

db.products.insertOne( { item: "card", qty: 15 } );

db.collection.insertMany() — MongoDB Manual

db.collection.insertMany()

db.collection.insertMany(
   [ <document 1> , <document 2>, ... ],
   {
      writeConcern: <document>,
      ordered: <boolean>
   }
)

db.products.insertMany( [
      { item: "card", qty: 15 },
      { item: "envelope", qty: 20 },
      { item: "stamps" , qty: 30 }

] );

5.删除

持续更新中.....

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值