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

Sample Project mongodb with phalcon Framework

Standard

Selain kemampuannya untuk memetakan tabel dalam database relasional, Phalcon dapat memetakan dokumen dari database NoSQL. ODM menawarkan fungsi CRUD, peristiwa, validasi antara layanan lainnya.

Karena tidak adanya query SQL dan perencana, database NoSQL dapat melihat perbaikan nyata dalam kinerja menggunakan pendekatan Phalcon. Selain itu, tidak ada bangunan SQL mengurangi kemungkinan suntikan SQL.

Untuk terkoneksi dengan mongoDB

Continue reading

Drop MongoDb

Standard

The drop() Method

MongoDB’s db.collection.drop() is used to drop a collection from the database.

SYNTAX:

Basic syntax of drop() command is as follows

db.COLLECTION_NAME.drop()

EXAMPLE:

Continue reading

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

Drop Database MongoDb

Standard

The dropDatabase() Method

MongoDB db.dropDatabase() command is used to drop a existing database.

SYNTAX:

Basic syntax of dropDatabase() command is as follows:

db.dropDatabase()

This will delete the selected database. If you have not selected any database, then it will delete default ‘test’ database

EXAMPLE:

Continue reading

Create Database MongoDb

Standard

The use Command

MongoDB use DATABASE_NAME is used to create database. The command will create a new database, if it doesn’t exist otherwise it will return the existing database.

SYNTAX:

Basic syntax of use DATABASE statement is as follows:

use DATABASE_NAME

EXAMPLE:

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