1.安装
也可以下载6.0.5,不过下载6.0.5需要在下一个mongodb的shell连接器,可以直接使用mongodb5.0.15的shell连接器
2.使用
启动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.删除
持续更新中.....