How To Restore MongoDB

Standard

Mongo db is raw data, so it’s different with mysql .

Restore mongoDb data is simple to restore it:

– mongorestore –db {name your mongodb}  {your dump path db like ~/mike/mongodb/dump/}

BackUp :

– First stop the process mongodb, On ubuntu you can type sudo service mongodb stop

– After stop process create folder you want to backup

– cd {your folder}

– mongodb –db {your mongodbname}

Referensi: http://www.thegeekstuff.com/2013/09/mongodump-mongorestore/

MongoDB: Mongodump terminate called after throwing an instance of ‘std::runtime_error’

Standard

If you encounter this error:

1
2
3
4
5
connected to: 127.0.0.1
Mon Oct 21 10:49:30.638 DATABASE: soft_production to dump/soft_production
terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid
Aborted

Please add this

1
2
3
export LC_ALL=C
# or
export LC_ALL="en_US.UTF-8"

either in the console (for current session) or in .bashrc file.

After that you should be ready to go with:

1
mongodump --db soft_production

Create Collactions

Standard

definisi

db.createCollection (nama, pilihan)
Menciptakan koleksi baru secara eksplisit.

Karena MongoDB menciptakan koleksi secara implisit ketika koleksi pertama dirujuk dalam perintah, metode ini digunakan terutama untuk menciptakan koleksi capped baru. Ini juga digunakan untuk pra-mengalokasikan ruang untuk koleksi biasa.

The db.createCollection () metode memiliki bentuk prototipe berikut:

Continue reading

Install MongoDb di Ubuntu

Standard

Install MongoDB

1
Import the public key used by the package management system.

The Ubuntu package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import the MongoDB public GPG Key:

sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 7F0CEB10

Create a list file for MongoDB:

Continue reading