MongoDB: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Tag: Manual revert
 
(36 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Raspbian==
==Raspbian==
<source lang="bash">
<syntaxhighlight lang="bash">
apt install mongodb
apt install mongodb
nano /etc/mongodb.conf
nano /etc/mongodb.conf
Line 11: Line 11:
systemctl enable mongodb
systemctl enable mongodb
systemctl status mongodb
systemctl status mongodb
</source>
</syntaxhighlight>


==Debian==
==Debian==
<source lang="bash">
{|
sudo apt install gnupg
| valign="top" |
sudo mkdir -p /etc/apt/keyrings
<syntaxhighlight lang="bash">
curl -fsSL https://pgp.mongodb.com/server-8.0.asc \
| sudo tee /etc/apt/keyrings/mongodb-8.0.asc >/dev/null


curl -fsSL https://pgp.mongodb.com/server-6.0.asc \
cat << SRC | sudo tee /etc/apt/sources.list.d/mongodb-8.0.list >/dev/null
| sudo gpg --dearmor -o /usr/share/keyrings/mongodb-server-6.0.gpg
deb [arch=$(dpkg --print-architecture)\
signed-by=/etc/apt/keyrings/mongodb-8.0.asc]\
https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse
SRC
</syntaxhighlight>


cat << EOF | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list >/dev/null
| valign="top" |
<syntaxhighlight lang="bash">
curl -fsSL https://pgp.mongodb.com/server-7.0.asc \
| sudo tee /etc/apt/keyrings/mongodb-7.0.asc >/dev/null
 
cat << SRC | sudo tee /etc/apt/sources.list.d/mongodb-7.0.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
deb [arch=$(dpkg --print-architecture)\
  signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg]\
  signed-by=/etc/apt/keyrings/mongodb-7.0.asc]\
  https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse
  https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse
EOF
SRC
</syntaxhighlight>


|-
| colspan="2" |
----
|-
| colspan="2" valign="top" |
<syntaxhighlight lang="bash">
sudo apt update
sudo apt update
sudo apt search  mongodb-org
sudo apt install mongodb-org
sudo apt install mongodb-org


Line 34: Line 53:
sudo systemctl daemon-reload
sudo systemctl daemon-reload
mongosh
mongosh
</source>
</syntaxhighlight>
 
|}


==MacOS==
==MacOS==
<source lang="bash">
<syntaxhighlight lang="bash">
brew tap | grep mongodb
brew tap | grep mongodb
xcode-select --install
xcode-select --install
Line 63: Line 84:
brew services start mongodb-community
brew services start mongodb-community
brew services list
brew services list
</source>
</syntaxhighlight>


==Mongo==
==Mongosh==
<source lang="bash">
<syntaxhighlight lang="bash">
mongo
mongosh
: <<'END_COMMENT'
: <<'END_COMMENT'
> show databases;
test> show databases;
local 0.03125GB
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",
  db: 'local',
"collections" : 2,
  collections: 1,
"objects" : 2,
  views: 0,
"avgObjSize" : 530,
  objects: 2,
"dataSize" : 1060,
  avgObjSize: 2370,
"storageSize" : 10493952,
  dataSize: 4740,
"numExtents" : 2,
  storageSize: 36864,
"indexes" : 0,
  indexes: 1,
"indexSize" : 0,
  indexSize: 36864,
"fileSize" : 16777216,
  totalSize: 73728,
"nsSizeMB" : 16,
  scaleFactor: 1,
"dataFileVersion" : {
  fsUsedSize: 296942022656,
"major" : 4,
  fsTotalSize: 371537641472,
"minor" : 5
  ok: 1
},
"ok" : 1
}
}
>
local>  
END_COMMENT
END_COMMENT
</source>
</syntaxhighlight>
 
==Compass==
<syntaxhighlight lang="bash">
sudo wget -c https://downloads.mongodb.com/compass/mongodb-compass_1.44.5_amd64.deb -P ${HOME}/Downloads
sudo dpkg -i    ${HOME}/Downloads/mongodb-compass_1.44.5_amd64.deb
sudo apt install ${HOME}/Downloads/mongodb-compass_1.44.5_amd64.deb
sudo rm  -rf    ${HOME}/Downloads/mongodb-compass_1.44.5_amd64.deb
sudo apt --fix-broken install
sudo apt install -f
</syntaxhighlight>
 
==Knowledge==
{|
|valign="top"|
sudo apt remove --auto-remove mc
sudo apt purge  --auto-remove mc
sudo apt purge mc
 
|valign="top"|
apt list --installed|grep mongodb-compass
sudo apt remove mongodb-compass
mongosh --quiet
 
|valign="top"|
 
|-
|colspan="3"|
----
|-
| valign="top" |
 
| valign="top" |
 
| valign="top" |
 
|}


==References==
==References==
{|
| valign="top" |
* [https://www.mongodb.com/try/download/compass MongoDB » Download » Compass (GUI)]
* [https://hevodata.com/learn/mongodb-compass-ubuntu/ MongoDB » Compass » On Ubuntu]
* [https://www.mongodb.com/try/download/shell MongoDB » Download » Shell (CLI)]
* [https://www.mongodb.com/blog/post/building-with-patterns-the-outlier-pattern MongoDB » Building With Patterns]
* [https://www.mongodb.com/docs/manual/core/data-model-design/ MongoDB » Data Model Design]
* [https://www.mongodb.com/developer/products/mongodb/schema-design-anti-pattern-massive-arrays/ MongoDB » Massive Arrays]
* [https://learn.mongodb.com/learning-paths/data-modeling-for-mongodb MongoDB » Data Modeling]
* [https://andyfelong.com/2019/01/mongodb-3-2-64-bit-running-on-raspberry-pi-3-with-caveats/ MongoDB » On Raspbian]
* [https://andyfelong.com/2019/01/mongodb-3-2-64-bit-running-on-raspberry-pi-3-with-caveats/ MongoDB » On Raspbian]
* [https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/ MongoDB » On Ubuntu]
* [https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/ MongoDB » On Ubuntu]
* [https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/ MongoDB » On macOS]
* [https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/ MongoDB » On macOS]
| valign="top" |
* [https://www.mongodb.com/developer/products/mongodb/mongodb-schema-design-best-practices/ MongoDB » Schema Design Best Practices]
* [https://www.mongodb.com/docs/manual/core/wiredtiger/ MongoDB » Storage Engine » WiredTiger]
* [https://stackoverflow.com/questions/33174655/ MongoDB » Async vs Sync Java Driver]
* [https://stackoverflow.com/questions/38303739/ MongoDB » Java Driver Sync & Async]
* [https://www.mongodb.com/docs/manual/release-notes/8.0/ MongoDB » Release Notes » 8.0]
* [https://www.mongodb.com/docs/manual/release-notes/7.0/ MongoDB » Release Notes » 7.0]
* [https://www.mongodb.com/docs/manual/administration/production-notes/ MongoDB » Production Notes]
* [https://www.mongodb.com/docs/manual/release-notes/ MongoDB » Release Notes]
| valign="top" |
|-
| colspan="3" |
----
|-
| valign="top" |
* [[Homebrew]]
* [[Homebrew]]
* [[Base64]]
* [[JQ Tool]]
* [[LuaJIT]]
* [[CIDR]]
* [[UFW]]
* [[Wrk]]
| valign="top" |
| valign="top" |
|}

Latest revision as of 19:35, 6 November 2024

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

curl -fsSL https://pgp.mongodb.com/server-8.0.asc \
 | sudo tee /etc/apt/keyrings/mongodb-8.0.asc >/dev/null

cat << SRC | sudo tee /etc/apt/sources.list.d/mongodb-8.0.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
 signed-by=/etc/apt/keyrings/mongodb-8.0.asc]\
 https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse
SRC
curl -fsSL https://pgp.mongodb.com/server-7.0.asc \
 | sudo tee /etc/apt/keyrings/mongodb-7.0.asc >/dev/null

cat << SRC | sudo tee /etc/apt/sources.list.d/mongodb-7.0.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
 signed-by=/etc/apt/keyrings/mongodb-7.0.asc]\
 https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse
SRC

sudo apt update
sudo apt search  mongodb-org
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

Compass

sudo wget -c https://downloads.mongodb.com/compass/mongodb-compass_1.44.5_amd64.deb -P ${HOME}/Downloads
sudo dpkg -i     ${HOME}/Downloads/mongodb-compass_1.44.5_amd64.deb
sudo apt install ${HOME}/Downloads/mongodb-compass_1.44.5_amd64.deb
sudo rm  -rf     ${HOME}/Downloads/mongodb-compass_1.44.5_amd64.deb
sudo apt --fix-broken install
sudo apt install -f

Knowledge

sudo apt remove --auto-remove mc
sudo apt purge  --auto-remove mc 
sudo apt purge mc
apt list --installed|grep mongodb-compass
sudo apt remove mongodb-compass
mongosh --quiet

References