Difference between revisions of "MongoDB"

From wikieduonline
Jump to navigation Jump to search
Line 37: Line 37:
 
* Connect to mongoDB: <code>[[mongo]]</code> or <code>mongo --host IP_TO_CONNECT</code>
 
* Connect to mongoDB: <code>[[mongo]]</code> or <code>mongo --host IP_TO_CONNECT</code>
 
* List database: <code>[[show dbs]]</code> or <code>[[show databases]]</code>
 
* List database: <code>[[show dbs]]</code> or <code>[[show databases]]</code>
* Connect to a database: <code>[[use]] <your_db_name></code>
+
* [[Connect to a database]]: <code>[[use]] <your_db_name></code>
 
* Backup your_db_name database to a file (<code>--archive</code>): <code>[[mongodump]] --archive=test.20150715.archive --db your_db_name</code>
 
* Backup your_db_name database to a file (<code>--archive</code>): <code>[[mongodump]] --archive=test.20150715.archive --db your_db_name</code>
 
* Backup database to binary JSON ([[BSON]]) files (<code>--out</code>): <code>mongodump --host mongodb1.example.net --port 37017 --username user --password "pass" --out /opt/backup/mongodump-2011-10-24</code>
 
* Backup database to binary JSON ([[BSON]]) files (<code>--out</code>): <code>mongodump --host mongodb1.example.net --port 37017 --username user --password "pass" --out /opt/backup/mongodump-2011-10-24</code>

Revision as of 12:12, 21 June 2020

wikipedia:MongoDB (2009) is an open-source document-oriented database using a JSON-like documents with schema. Listen by default on port TCP 27017.

  • Installation: brew tap mongodb/brew && brew install mongodb-community
  • Runnig manually: mongod --config /usr/local/etc/mongod.conf --fork

Features

Binaries

Editions

  • MongoDB Community Server

Releases

  • 4.2

Configuration

Commands

  • Connect to mongoDB: mongo or mongo --host IP_TO_CONNECT
  • List database: show dbs or show databases
  • Connect to a database: use <your_db_name>
  • Backup your_db_name database to a file (--archive): mongodump --archive=test.20150715.archive --db your_db_name
  • Backup database to binary JSON (BSON) files (--out): mongodump --host mongodb1.example.net --port 37017 --username user --password "pass" --out /opt/backup/mongodump-2011-10-24
  • mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1
  • mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1 --bind_ip_all
  • db.myCollection.find() or db.myCollection.find().pretty()
  • show tables, show collections

Docker

Customers

Related terms

Activities

See also

Advertising: