Skip to content

✍️ 필사 모드: How to install mongoDB in Ubuntu22.04

한국어
0%
정확도 0%
💡 왼쪽 원문을 읽으면서 오른쪽에 따라 써보세요. Tab 키로 힌트를 받을 수 있습니다.

Steps

sudo apt update
sudo apt install wget curl gnupg2 software-properties-common apt-transport-https ca-certificates lsb-release
sudo curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/mongodb-6.gpg
sudo echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt update
sudo apt install mongodb-org
sudo systemctl enable --now mongod
sudo systemctl status mongod
mongod --version

MongoDB insert test

testing> show dbs
admin   40.00 KiB
config  12.00 KiB
local   40.00 KiB
testing> db
DBQuery  DBRef    db

testing> db.message.insertOne({
... user: "tom",
... age: "23",
... log: "Hello, MongoDB!"
... })
{
  acknowledged: true,
  insertedId: ObjectId("64a6ed38759a9d8c994b8567")
}
testing> show collections
message
testing> db.message.insertOne({ user: "billy", age: 23, log: "Hello, MongoDB is Fun!!" })
{
  acknowledged: true,
  insertedId: ObjectId("64a6ed67759a9d8c994b8568")
}
testing> db.message
db.message

testing> db.message.find()
[
  {
    _id: ObjectId("64a6ed38759a9d8c994b8567"),
    user: 'tom',
    age: '23',
    log: 'Hello, MongoDB!'
  },
  {
    _id: ObjectId("64a6ed67759a9d8c994b8568"),
    user: 'billy',
    age: 23,
    log: 'Hello, MongoDB is Fun!!'
  }
]

Reference

현재 단락 (1/49)

sudo apt update

작성 글자: 0원문 글자: 1,253작성 단락: 0/49