Mongo Db - First Look

Definition

Mongo db is a scalable, high-performance, open source, schema-free, document-oriented database.

Advantages

Here are some of the advantages of MongoDB for building web applications:
  1. A document-based data model. The basic unit of storage is analogous to JSON, Python dictionaries, Ruby hashes, etc. This is a rich data structure capable of holding arrays and other documents. This means you can often represent in a single entity a construct what would require several tables to properly represent in a relational db.
  2. Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language that's nearly as powerful as SQL.
  3. No schema migrations. Since MongoDB is schema-free, your code defines your schema.
  4. Better performance. There are many reasons for this. One is that, since the document model frequently doesn't need joins, MongoDB doesn't support them; another is that MongoDB uses memory-mapped files and a different consistency model.
  5. A clear path to horizontal scalability.


Steps to start Mongo db

  1. Run “mongod –dbpath c:\data\db ”
  2. Start the mongo console by running “mongo” from the mongo bin.

Some basic commands to explore Mongo db 

mongos> show dbs
abcdb
xyzdb
mongos> use xyzdb
switched to db xyzdb
mongos> show collections
xyz
mongos>db.xyz.find({})


Steps to import db from a different server

  1. Connect to mongo console of the server from the local installations with the tunnel settings.
  2. Run “mongodump” from MONGO_HOME/bin.
  3. This will generate a dump folder with the backup of all collection from the dev on your local file system in a folder  MONGO_HOME/dump.
  4. Remove tunnel settings and restart mongod and mongo console.
  5. Run “mongorestore –dbpath C:\data\db” from MONGO_HOME/bin
  6. This will copy all data files in your local db.

Comments

Popular posts from this blog

jQgrid reload with new data

Rich Client based UI technologies- A Comparison of Thick Client UI tools

OSS and BSS Systems