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/

SQL Server On Ubuntu

Standard

Inspect Server Settings

There are three significant aspects that users may neglect, which lead to the failure of the connection to the SQL Server.

Enable TCP/IP Connection

To check whether your server enabled to TCP/IP connections:

Continue reading

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

How do I change the privileges for MySQL user that is already created?

Standard

To list users:

select user,host from mysql.user;

To show privileges:

show grants for 'user'@'host';

To change privileges, first revoke. Such as:

revoke all privileges on *.* from 'user'@'host';

Then grant the appropriate privileges as desired:

grant SELECT,INSERT,UPDATE,DELETE ON `db`.* TO 'user'@'host';

Table:

GRANTALTER,CREATEON example TO'someuser'@'somehost'

Finally, flush:

flush privileges;

The MySQL documentation is excellent:

http://dev.mysql.com/doc/refman/5.0/en/user-account-management.html

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