MongoDB: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
==Raspbian==
<source lang="bash">
<source lang="bash">
apt install mongodb
apt install mongodb
Line 10: Line 11:
systemctl enable mongodb
systemctl enable mongodb
systemctl status mongodb
systemctl status mongodb
</source>
==MacOS==
<source lang="bash">
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
</source>
==Mongo==
<source lang="bash">
mongo
mongo
: <<'END_COMMENT'
: <<'END_COMMENT'
Line 42: Line 76:


==References==
==References==
* [https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/ Install MongoDB Community Edition on macOS]
* [https://andyfelong.com/2019/01/mongodb-3-2-64-bit-running-on-raspberry-pi-3-with-caveats/ MongoDB running on a Raspberry Pi]
* [https://andyfelong.com/2019/01/mongodb-3-2-64-bit-running-on-raspberry-pi-3-with-caveats/ MongoDB running on a Raspberry Pi]
* [[Homebrew]]

Revision as of 11:00, 11 January 2021

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

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

Mongo

mongo
: <<'END_COMMENT'
> show databases;
local	0.03125GB
> use local
switched to db local
> show collections;
startup_log
> db.stats();
{
	"db" : "local",
	"collections" : 2,
	"objects" : 2,
	"avgObjSize" : 530,
	"dataSize" : 1060,
	"storageSize" : 10493952,
	"numExtents" : 2,
	"indexes" : 0,
	"indexSize" : 0,
	"fileSize" : 16777216,
	"nsSizeMB" : 16,
	"dataFileVersion" : {
		"major" : 4,
		"minor" : 5
	},
	"ok" : 1
}
>
END_COMMENT

References