MongoDB: Difference between revisions
Jump to navigation
Jump to search
(→Mongo) |
|||
Line 69: | Line 69: | ||
mongosh | mongosh | ||
: <<'END_COMMENT' | : <<'END_COMMENT' | ||
> show databases; | test> show databases; | ||
local | admin 40.00 KiB | ||
> use local | config 12.00 KiB | ||
local 72.00 KiB | |||
test> use local | |||
switched to db local | switched to db local | ||
> show collections; | local> show collections; | ||
startup_log | startup_log | ||
> db.stats(); | local> db.stats(); | ||
{ | { | ||
db: 'local', | |||
collections: 1, | |||
views: 0, | |||
objects: 2, | |||
avgObjSize: 2370, | |||
dataSize: 4740, | |||
storageSize: 36864, | |||
indexes: 1, | |||
indexSize: 36864, | |||
totalSize: 73728, | |||
scaleFactor: 1, | |||
fsUsedSize: 296942022656, | |||
fsTotalSize: 371537641472, | |||
ok: 1 | |||
} | } | ||
> | local> | ||
END_COMMENT | END_COMMENT | ||
</source> | </source> |
Revision as of 23:06, 10 May 2023
Raspbian
apt install mongodb
nano /etc/mongodb.conf
: <<'END_COMMENT'
bind_ip = 127.0.0.1,10.19.83.105
port = 27017
END_COMMENT
systemctl start mongodb
systemctl enable mongodb
systemctl status mongodb
Debian
sudo apt install gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://pgp.mongodb.com/server-6.0.asc \
| sudo gpg --dearmor -o /usr/share/keyrings/mongodb-server-6.0.gpg
cat << EOF | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg]\
https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse
EOF
sudo apt update
sudo apt install mongodb-org
ps --no-headers -o comm 1
sudo systemctl status mongod
sudo systemctl daemon-reload
mongosh
MacOS
brew tap | grep mongodb
xcode-select --install
brew tap mongodb/brew
brew tap
brew services stop mongodb-community
brew uninstall mongodb-community
brew cleanup
rm -rf ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community*
rm -rf /usr/local/var/mongodb*
brew install mongodb-community
brew services start mongodb-community
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
brew services stop mongodb-community
vim /usr/local/etc/mongod.conf
: <<'END_COMMENT'
net:
bindIp: 127.0.0.1,10.19.83.110
END_COMMENT
brew services start mongodb-community
brew services list
Mongosh
mongosh
: <<'END_COMMENT'
test> show databases;
admin 40.00 KiB
config 12.00 KiB
local 72.00 KiB
test> use local
switched to db local
local> show collections;
startup_log
local> db.stats();
{
db: 'local',
collections: 1,
views: 0,
objects: 2,
avgObjSize: 2370,
dataSize: 4740,
storageSize: 36864,
indexes: 1,
indexSize: 36864,
totalSize: 73728,
scaleFactor: 1,
fsUsedSize: 296942022656,
fsTotalSize: 371537641472,
ok: 1
}
local>
END_COMMENT