Arch Linuxii mongodb 1:2.4.9-1ubuntu2 amd64 object/document-oriented database (metapackage)
yay mongodb-bin
yay mongodb-tools
DriversConsole
How to start servercd mongodb-linux-x86_64-2.0.6
bin/mongod --dbpath /var/tmp/mongodb
/etc/mongodb.conf port = 27017 sudo systemctl status mongodb sudo systemctl stop mongodb /var/log/mongodb/mongodb.log
PHP
sudo apt install php-pear php7.2-devUbuntu 16.04
sudo pecl install mongodb
/etc/php/7.2/cli/php.ini
extension=mongodb.so
sudo apt install php-pear php7.0-dev
sudo apt install pkg-config sudo pecl install mongodb
/etc/php/7.0/cli/php.ini
extension=mongodb.so
mongo-php-driver mongodb-mongo-php-driver-1.1.4-3-gdb58b36.tar.gz $ phpizePython
$ ./configure
$ make
$ sudo make install Then add
extension=mongo.so
to /etc/php5/cli/php.ini
& /etc/php5/apache2/php.ini
PyMongo 1.5.1Perlii python-pymongo 2.2-4 amd64 Python interface to the MongoDB document-oriented databasesudo apt install python3-pymongo yay python-pymongo
libmodule-install-perlRuby
libclass-meta-perl
libany-moose-perl
libfile-slurp-perl
libboolean-perl
# gem install mongoJava
# gem install bson_ext
mongo-java-driverC#
mongo-java-driver-3.0.3.jar
mongodb-csharp
$ mongo MongoDB shell version: 3.2.9 connecting to: test > db test > show dbs city_db 0.203125GB exampleDb 0.203125GB local 0.078125GB > use city_db switched to db city_db > db city_db > show collections saitama system.indexes > db.saitama.find () { "_id" : ObjectId("538d2fc65f87ddfac4108581"), "key" : "t1161", "name" : "さいたま", "population" : 58143, "date_mod" : "2001-9-12" } { "_id" : ObjectId("538d2fc65f87ddfac4108582"), "key" : "t1162", "name" : "所沢", "population" : 62987, "date_mod" : "2001-10-9" } > exit bye
# pacman -S mongodb # pacman -S mongodb-tools # pacman -S php-mongodb # pacman -S python-pymongo $ yaourt -Sb ruby-mongo $ yaourt -Sb ruby-bson_ext # systemctl start mongodb設定ファイル
/etc/mongodb.conf
$ mongodump --host localhost --db city_db $ mongodump --gzip --db city_dbリストア
mongorestore --host localhost --db city_db ./dump/city_db $ mongorestore --gzip --db city_db --dir dump/city_db/
ExecStart=/usr/bin/mongod --quiet --rest --config /etc/mongodb.conf http://localhost:28017/Remote からの接続
mongo admin --host example.com:27017 -u scott -p tiger123スーパーユーザーの作成方法
> use admin switched to db admin > db.createUser({user: "scott",pwd: "tiger123",roles: ["userAdminAnyDatabase","readWriteAnyDatabase","dbAdminAnyDatabase"]}) Successfully added user: { "user" : "hapo", "roles" : [ "userAdminAnyDatabase", "readWriteAnyDatabase", "dbAdminAnyDatabase" ] } >